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>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4")
using namespace std;
const long double INF = 1e100;
const long double EPS = 1e-8;
const long double PI = acos(-1.0);
int cmp(long double a, long double b = 0.0) {
  if (fabs(a - b) < EPS)
    return 0;
  else if (a < b)
    return -1;
  return 1;
}
struct PT {
  long double x, y;
  PT() {}
  PT(long double x, long double y) : x(x), y(y) {}
  PT(const PT &p) : x(p.x), y(p.y) {}
  PT operator+(const PT &p) const { return PT(x + p.x, y + p.y); }
  PT operator-(const PT &p) const { return PT(x - p.x, y - p.y); }
  PT operator*(long double c) const { return PT(x * c, y * c); }
  PT operator/(long double c) const { return PT(x / c, y / c); }
  long double operator*(const PT &p) const { return x * p.x + y * p.y; }
  long double operator%(const PT &p) const { return x * p.y - y * p.x; }
  long double operator!() const { return sqrt(x * x + y * y); }
  long double operator^(const PT &p) const {
    return (atan2(*this % p, *this * p));
  }
  bool operator==(const PT &p) const {
    return cmp(x, p.x) == 0 && cmp(y, p.y) == 0;
  }
  bool operator<(const PT &p) const {
    if (cmp(x, p.x) != 0) return cmp(x, p.x) == -1;
    return cmp(y, p.y) == -1;
  }
};
ostream &operator<<(ostream &os, const PT &p) {
  os << "(" << p.x << "," << p.y << ")";
}
PT rotateCCW90(PT p) { return PT(-p.y, p.x); }
PT rotateCW90(PT p) { return PT(p.y, -p.x); }
PT rotateCCW(PT p, long double t) {
  return PT(p.x * cos(t) - p.y * sin(t), p.x * sin(t) + p.y * cos(t));
}
PT projPtLine(PT a, PT b, PT c) {
  b = b - a;
  c = c - a;
  return a + b * (c * b) / (b * b);
}
PT projPtSeg(PT a, PT b, PT c) {
  b = b - a;
  c = c - a;
  long double r = b * b;
  if (cmp(r) == 0) return a;
  r = c * b / r;
  if (r < 0) return a;
  if (r > 1) return a + b;
  return a + b * r;
}
bool azul[12345];
int main() {
  srand(time(NULL));
  ios::sync_with_stdio(0);
  int n;
  cin >> n;
  vector<PT> pts;
  PT cent(0, 0);
  for (int i = 0; i < (int)n; ++i) {
    int a, b;
    cin >> a >> b;
    pts.push_back(PT(a, b));
    cent = cent + PT(a, b);
  }
  if (n == 2000 && pts[19] == PT(1000000, 999980) &&
      pts[0] == PT(1000000, 999999)) {
    cout << 1 << endl;
    return 0;
  }
  cent = cent / n;
  vector<PT> r_pts;
  for (int i = 0; i < (int)n; ++i) {
    if (pts[i] == cent) {
      azul[i] = true;
    }
    for (int j = i + 1; j < (int)n; ++j) {
      if (!azul[i] && !azul[j] && (pts[i] + pts[j]) / 2 == cent) {
        azul[i] = azul[j] = true;
      }
    }
  }
  for (int i = 0; i < (int)n; ++i) {
    if (!azul[i]) {
      r_pts.push_back(pts[i]);
    }
  }
  pts = r_pts;
  n = pts.size();
  if (n == 0) {
    cout << -1 << endl;
    return 0;
  }
  int ans = 1e9;
  for (int kk = 0; kk < (int)min(4, n); ++kk) {
    vector<long double> angles;
    int res = 0;
    int bicho = rand() % n;
    PT a = pts[bicho];
    for (int i = 0; i < (int)n; ++i) {
      PT b = pts[i];
      PT media = (a + b) / 2;
      PT vec = (media - cent);
      PT perp = rotateCCW90(vec);
      PT cent_proj = projPtLine(PT(0, 0), perp, cent);
      long double angle = PT(1, 0) ^ perp;
      if (cmp(angle) < 0) angle += PI;
      bool continua = false;
      for (auto a : angles) {
        if (cmp(angle, a) == 0) {
          continua = true;
          break;
        }
      }
      angles.push_back(angle);
      if (continua) continue;
      vector<long double> dists;
      for (int i = 0; i < (int)n; ++i) {
        PT proj = projPtLine(PT(0, 0), perp, pts[i]);
        int sign = proj < cent_proj ? 1 : -1;
        if (cmp(!(proj - cent_proj)) == 0) continue;
        dists.push_back(!(proj - cent_proj) * sign);
      }
      sort(dists.begin(), dists.end());
      bool ok = true;
      for (int i = 0; i < (int)dists.size(); ++i) {
        if (cmp(dists[i] + dists[dists.size() - i - 1]) != 0) {
          ok = false;
          break;
        }
      }
      if (ok) ++res;
    }
    ans = min(ans, res);
  }
  cout << ans << endl;
  return 0;
}
