#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-8;
const int MAXN = 2005;
int cnt, n;
double d[MAXN];
int vis[MAXN];
struct Tpoint {
  double x, y;
  inline Tpoint() {}
  inline Tpoint(double xx, double yy) {
    x = xx;
    y = yy;
  }
  inline Tpoint operator+(const Tpoint &A) const {
    return Tpoint(x + A.x, y + A.y);
  }
  inline Tpoint operator-(const Tpoint &A) const {
    return Tpoint(x - A.x, y - A.y);
  }
  inline Tpoint operator/(const double &A) const {
    return Tpoint(x / A, y / A);
  }
  inline double operator*(const Tpoint &A) const { return x * A.x + y * A.y; }
  inline double operator^(const Tpoint &A) const { return x * A.y - y * A.x; }
};
Tpoint p[MAXN];
struct Tline {
  Tpoint s, t;
  inline Tline() {}
  inline Tline(Tpoint ss, Tpoint tt) {
    s = ss;
    t = tt;
  }
  inline double get_dis(Tpoint P) { return (t ^ (P - s)) / sqrt(t * t); }
  inline bool sam(Tline L) {
    if (abs(t ^ L.t) > eps) return false;
    if (abs(t ^ (L.s - s)) > eps) return false;
    return true;
  }
};
Tline l[MAXN];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%lf%lf", &p[i].x, &p[i].y);
  if (n <= 2) {
    printf("-1\n");
    return 0;
  }
  if (p[1] * p[1] < eps) swap(p[1], p[2]);
  Tpoint O(0, 0);
  for (int i = 1; i <= n; ++i) O = O + p[i];
  O = O / n;
  int tmp = 0, pos;
  for (int i = 1; i <= n; ++i) {
    bool flag = false;
    for (int j = 1; j <= n; ++j) {
      if (((p[i] + p[j]) * (p[i] + p[j])) < eps ||
          ((((p[i] + p[j]) / 2 - O) * ((p[i] + p[j]) / 2 - O)) < eps)) {
        flag = true;
        break;
      }
    }
    if (flag)
      ++tmp;
    else
      pos = i;
  }
  if (tmp == n) {
    printf("-1\n");
    return 0;
  }
  swap(p[1], p[pos]);
  for (int i = 1; i <= n; ++i) {
    if (((p[1] + p[i]) * (p[1] + p[i])) < eps) continue;
    if ((((p[1] + p[i]) / 2 - O) * ((p[1] + p[i]) / 2 - O)) < eps) continue;
    Tpoint tp = (p[1] + p[i]) / 2;
    Tline tl = Tline(tp, tp - O);
    for (int j = 1; j <= n; ++j) d[j] = tl.get_dis(p[j]);
    sort(d + 1, d + n + 1);
    bool flag = true;
    for (int i = 1; i <= n; ++i) {
      if (d[i] + d[n - i + 1] > eps) {
        flag = false;
        break;
      }
    }
    if (flag) l[++cnt] = tl;
  }
  int ans = 0;
  for (int i = 1; i <= cnt; ++i) {
    int flag = true;
    for (int j = 1; j < i; ++j)
      if (l[i].sam(l[j])) {
        flag = false;
        break;
      }
    if (flag) ++ans;
  }
  printf("%d\n", ans);
  return 0;
}
