#include <bits/stdc++.h>
using namespace std;
const int N = 2e3 + 50;
double eps = 1e-10;
int sgn(double a) { return (a > eps) - (a < -eps); }
struct pnt {
  double x, y;
  pnt(double _x = 0, double _y = 0) {
    x = _x;
    y = _y;
  }
  void input() { scanf("%lf%lf", &x, &y); }
  void out() { cout << x << ' ' << y << '\n'; }
  bool operator<(const pnt &a) const {
    return sgn(a.x - x) > 0 || (!sgn(x - a.x) && sgn(a.y - y) > 0);
  }
  pnt operator+(const pnt &a) { return pnt(x + a.x, y + a.y); }
  pnt operator-(const pnt &a) { return pnt(x - a.x, y - a.y); }
  double operator*(const pnt &a) { return x * a.y - y * a.x; }
  bool operator==(const pnt &a) { return !sgn(x - a.x) && !sgn(y - a.y); }
  double len() { return sqrt(x * x + y * y); }
  void norm() {
    double l = len();
    x = x / l;
    y = y / l;
  }
  void rot() {
    pnt t(-y, x);
    *this = t;
  }
};
double dot(pnt a, pnt b) { return a.x * b.x + a.y * b.y; }
int n;
pnt a[N];
bool ban[N];
pnt dir[N * N];
int sz;
bool chk(pnt dir, pnt t) {
  static double d[N];
  for (int i = 1; i <= n; i++) {
    d[i] = dot(dir, (a[i] - t));
  }
  sort(d + 1, d + n + 1);
  for (int i = 1, j = n; i <= j; i++, --j)
    if (sgn(d[i] + d[j])) return false;
  return true;
}
int main() {
  scanf("%d", &n);
  pnt t;
  for (int i = 1; i <= n; i++) a[i].input(), t = t + a[i];
  t.x = t.x / n;
  t.y = t.y / n;
  int ct = 0;
  for (int i = 1; i <= n; i++)
    if (!ban[i]) {
      pnt v = t + t - a[i];
      int ok = 0;
      for (int j = 1; !ok && j <= n; j++)
        if (a[j] == v) ok = j;
      if (ok) {
        ban[i] = ban[ok] = true;
        continue;
      }
      set<pnt> tmp;
      for (int j = 1; j <= n; j++) {
        pnt d = v - a[j];
        d.rot();
        if (d.x < 0) d.x = -d.x, d.y = -d.y;
        if (!sgn(d.x) && d.y < 0) d.y = -d.y;
        d.norm();
        if (tmp.find(d) == tmp.end()) tmp.insert(d), dir[++sz] = d;
      }
    }
  for (int i = 1; i <= n; i++) ct += ban[i];
  if (n - ct <= 0) return cout << "-1", 0;
  sort(dir + 1, dir + sz + 1);
  int Ans = 0;
  for (int l = 1, r = 1; l <= sz; l = r) {
    while (dir[l] == dir[r]) ++r;
    if (r - l >= n - ct) Ans += chk(dir[l], t);
  }
  cout << Ans;
  return 0;
}
