You are given a set of n points on the plane. A line containing the origin is called good, if projection of the given set to this line forms a symmetric multiset of points. Find the total number of good lines.

Multiset is a set where equal elements are allowed.

Multiset is called symmetric, if there is a point P on the plane such that the multiset is [centrally symmetric](https://en.wikipedia.org/wiki/Point_reflection) in respect of point P.

Input

The first line contains a single integer n (1 ≤ n ≤ 2000) — the number of points in the set.

Each of the next n lines contains two integers xi and yi ( - 106 ≤ xi, yi ≤ 106) — the coordinates of the points. It is guaranteed that no two points coincide.

Output

If there are infinitely many good lines, print -1.

Otherwise, print single integer — the number of good lines.

Examples

Input

3
1 2
2 1
3 3


Output

3


Input

2
4 3
1 2


Output

-1

Note

Picture to the first sample test:

<image>

In the second sample, any line containing the origin is good.
#include <bits/stdc++.h>
using namespace std;
using lli = long long int;
using ll = lli;
using llu = unsigned long long int;
using pii = tuple<lli, lli>;
using piii = tuple<lli, lli, lli>;
using vi = vector<lli>;
using vii = vector<pii>;
using viii = vector<piii>;
using vvi = vector<vi>;
using vvii = vector<vii>;
using vviii = vector<viii>;
using vb = vector<bool>;
using vvb = vector<vb>;
lli gcd(lli a, lli b) { return b == 0 ? a : gcd(b, a % b); }
int main() {
  int n;
  scanf("%d", &n);
  vi x(n), y(n);
  lli sx = 0, sy = 0;
  for (lli i = 0; i < (lli)(n); ++i) {
    scanf("%lld%lld", &x[i], &y[i]);
    sx += x[i];
    sy += y[i];
  }
  for (lli i = 0; i < (lli)(n); ++i) {
    x[i] = n * x[i] - sx;
    y[i] = n * y[i] - sy;
  }
  map<pii, int> M;
  for (lli i = 0; i < (lli)(n); ++i) {
    M[make_tuple(x[i], y[i])]++;
    M[make_tuple(-x[i], -y[i])]--;
  }
  int c = 0;
  for (auto it : M)
    if (it.second != 0) c++;
  if (c <= 2) {
    puts("-1");
    return 0;
  }
  set<pii> S;
  for (auto u : M)
    if (u.second > 0) {
      for (auto v : M)
        if (v.second > 0) {
          lli dx = -get<1>(u.first) - get<1>(v.first),
              dy = get<0>(u.first) + get<0>(v.first);
          lli g = gcd(dx, dy);
          dx /= g;
          dy /= g;
          vi a, b;
          for (auto w : M)
            if (w.second > 0) {
              lli p = dx * get<0>(w.first) + dy * get<1>(w.first);
              if (p < 0) a.push_back(-p);
              if (p > 0) b.push_back(p);
            }
          sort((a).begin(), (a).end());
          sort((b).begin(), (b).end());
          if (a == b) S.insert(make_tuple(dx, dy));
        }
      break;
    }
  printf("%d\n", (int)S.size());
}
