#include <bits/stdc++.h>
using namespace std;
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
  std::fill((T *)array, (T *)(array + N), val);
}
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
struct point {
  long double x;
  long double y;
  point(){};
};
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long n;
  cin >> n;
  vector<long long> x(n), y(n);
  vector<point> v;
  long double sx = 0.0, sy = 0.0;
  for (int i = 0; i < (int)(n); ++i) {
    cin >> x[i] >> y[i];
    sx += x[i];
    sy += y[i];
  }
  if (n <= 2) {
    cout << -1 << endl;
    return 0;
  }
  sx /= (long double)n;
  sy /= (long double)n;
  for (int i = 0; i < (int)(n); ++i) {
    if (abs(sx - x[i]) <= 1e-7 && abs(sy - y[i]) <= 1e-7) {
    } else {
      point a;
      a.x = x[i];
      a.y = y[i];
      v.push_back(a);
    }
  }
  n = v.size();
  if (n <= 2) {
    cout << -1 << endl;
    return 0;
  }
  bool ok = 1;
  vector<pair<long double, long double> > s;
  for (int i = 0; i < (int)(n); ++i) {
    s.push_back(make_pair(v[i].x, v[i].y));
  }
  sort(s.begin(), s.end());
  vector<bool> flag(n, 1);
  for (int i = 0; i < (int)(n); ++i) {
    for (int j = 0; j < (int)(n); ++j) {
      if (abs(s[i].first + s[j].first - 2 * sx) < 1e-7 &&
          abs(s[i].second + s[j].second - 2 * sy) < 1e-7) {
        flag[i] = 0;
        flag[j] = 0;
      }
    }
  }
  int ss = 0;
  v.clear();
  for (int i = 0; i < (int)(n); ++i) {
    if (flag[i]) {
      ss++;
      point a;
      a.x = s[i].first;
      a.y = s[i].second;
      v.push_back(a);
    }
  }
  if (ss <= 2) {
    cout << -1 << endl;
    return 0;
  }
  n = ss;
  vector<pair<long double, long double> > res;
  if (n % 2 == 0) {
    for (int i = 0; i < (int)(n - 1); ++i) {
      point a = v[0];
      point b = v[i + 1];
      long double mx = (a.x + b.x) / 2.0;
      long double my = (a.y + b.y) / 2.0;
      long double rx = (mx - sx);
      long double ry = (my - sy);
      swap(rx, ry);
      ry = -ry;
      long double d = sqrt(rx * rx + ry * ry);
      rx /= d;
      ry /= d;
      if (rx < 0) {
        rx = -rx;
        ry = -ry;
      }
      vector<long double> s;
      for (int j = 0; j < (int)(n); ++j) {
        long double X = v[j].x;
        long double Y = v[j].y;
        s.push_back(rx * (sx - X) + ry * (sy - Y));
      }
      sort(s.begin(), s.end());
      bool ng = 0;
      for (int j = 0; j < (int)(n); ++j) {
        if (abs(s[j] + s[n - 1 - j]) > 1e-7) {
          ng = 1;
        }
      }
      if (!ng) {
        res.push_back(make_pair(rx, ry));
      }
    }
  } else {
    for (int i = 0; i < (int)(n); ++i) {
      point a = v[i];
      long double mx = a.x;
      long double my = a.y;
      long double rx = (mx - sx);
      long double ry = (my - sy);
      swap(rx, ry);
      ry = -ry;
      long double d = sqrt(rx * rx + ry * ry);
      rx /= d;
      ry /= d;
      if (rx < 0) {
        rx = -rx;
        ry = -ry;
      }
      vector<long double> s;
      for (int j = 0; j < (int)(n); ++j) {
        long double X = v[j].x;
        long double Y = v[j].y;
        s.push_back(rx * (sx - X) + ry * (sy - Y));
      }
      sort(s.begin(), s.end());
      bool ng = 0;
      for (int j = 0; j < (int)(n); ++j) {
        if (abs(s[j] + s[n - 1 - j]) > 1e-7) {
          ng = 1;
        }
      }
      if (!ng) {
        res.push_back(make_pair(rx, ry));
      }
    }
  }
  sort(res.begin(), res.end());
  int m = res.size();
  int sm = m;
  vector<bool> used(m);
  for (int i = 0; i < (int)(m); ++i) {
    for (int j = i + 1; j < m; j++) {
      if (abs(res[i].first - res[j].first) <= 1e-7 &&
          abs(res[i].second - res[j].second) <= 1e-7) {
        used[j] = 1;
      }
    }
  }
  for (int i = 0; i < (int)(m); ++i) {
    if (used[i]) sm--;
  }
  cout << sm << endl;
  return 0;
}
