#include <bits/stdc++.h>
using namespace std;
long long modu = (1LL << 31) - 1;
long long modu2 = (1LL << 62) - 1;
pair<long long, long long> add(pair<long long, long long> a,
                               pair<long long, long long> b) {
  long long a1 = a.first, b1 = b.first;
  long long a2 = a.second, b2 = b.second;
  int sgn, sgna, sgnb;
  bool same;
  if (a1 < 0 || a2 < 0)
    sgna = -1, a1 = -a1, a2 = -a2;
  else
    sgna = (a1 > 0 || a2 > 0);
  if (b1 < 0 || b2 < 0)
    sgnb = -1, b1 = -b1, b2 = -b2;
  else
    sgnb = (b1 > 0 || b2 > 0);
  if (sgna == 0 && sgnb == 0)
    sgn = 0;
  else if (sgna >= 0 && sgnb >= 0)
    sgn = 1, same = 1;
  else if (sgna <= 0 && sgnb <= 0)
    sgn = -1, same = 1;
  else {
    same = 0;
    if (a1 > b1)
      sgn = sgna;
    else if (a1 < b1)
      sgn = sgnb;
    else {
      if (a2 > b2)
        sgn = sgna;
      else if (a2 < b2)
        sgn = sgnb;
      else
        sgn = 0;
    }
  }
  if (sgn == 0) return make_pair(0, 0);
  long long c1, c2;
  if (same == 1) {
    c2 = a2 + b2;
    c1 = a1 + b1;
    if (c2 & 1 << 62L) c2 ^= 1 << 62L, c1++;
  } else {
    if (sgn == sgna) {
      c2 = a2 - b2;
      c1 = a1 - b1;
      if (c2 & 1 << 63L) c2 += 1LL << 62, c1--;
    } else {
      c2 = b2 - a2;
      c1 = b1 - a1;
      if (c2 & 1 << 63L) c2 += 1LL << 62, c1--;
    }
  }
  c1 *= sgn;
  c2 *= sgn;
  return make_pair(c1, c2);
}
pair<long long, long long> mult(long long a, long long b) {
  if (a == 0 || b == 0) {
    return make_pair(0, 0);
  }
  int sgn = 1;
  if (a < 0) sgn *= -1, a = -a;
  if (b < 0) sgn *= -1, b = -b;
  long long a1 = a >> 31, a2 = a & modu;
  long long b1 = b >> 31, b2 = b & modu;
  long long c2 = a2 * b2;
  long long c1 = a1 * b1;
  long long tmp = a1 * b2 + a2 * b1;
  c2 += (tmp & modu) << 31;
  c1 += tmp >> 31;
  if (c2 & 1 << 62L) c2 ^= 1 << 62L, c1++;
  c1 *= sgn;
  c2 *= sgn;
  return make_pair(c1, c2);
}
long long x[2000], y[2000];
bool exs[2000];
vector<pair<long long, long long>> K, dst;
bool cmp(pair<long long, long long> a, pair<long long, long long> b) {
  pair<long long, long long> tmp = b;
  tmp.first = -tmp.first;
  tmp.second = -tmp.second;
  tmp = add(a, tmp);
  return tmp.first < 0 || tmp.second < 0;
}
int main() {
  int n, i, j;
  scanf("%d", &n);
  long long cx = 0, cy = 0;
  for (i = 0; i < n; i++) {
    scanf("%lld%lld", x + i, y + i);
    cx += x[i], cy += y[i];
    x[i] *= n, y[i] *= n;
  }
  for (i = 0; i < n; i++) {
    exs[i] = !(x[i] == cx && y[i] == cy);
  }
  for (i = 0; i < n; i++) {
    if (!exs[i]) continue;
    for (j = i + 1; j < n; j++) {
      if (!exs[j]) continue;
      if (x[i] + x[j] == 2 * cx && y[i] + y[j] == 2 * cy) {
        exs[i] = exs[j] = 0;
        break;
      }
    }
  }
  for (i = 0, j = 0; i < n; i++) {
    if (exs[i]) {
      x[j] = x[i];
      y[j] = y[i];
      j++;
    }
  }
  n = j;
  if (n == 0) {
    printf("-1\n");
    return 0;
  }
  long long m2x, m2y, ex, ey;
  pair<long long, long long> dc;
  bool suc;
  K.clear();
  for (i = 0; i < n; i++) {
    m2x = x[0] + x[i];
    m2y = y[0] + y[i];
    ey = 2 * cx - m2x;
    ex = -2 * cy + m2y;
    dc = add(mult(cx, ex), mult(cy, ey));
    dst.clear();
    for (j = 0; j < n; j++) {
      dst.push_back(add(mult(x[j], ex), mult(y[j], ey)));
    }
    sort(dst.begin(), dst.end(), cmp);
    suc = true;
    for (j = 0; j <= n / 2; j++) {
      if (add(dst[j], dst[n - 1 - j]) != add(dc, dc)) {
        suc = false;
        break;
      }
    }
    if (suc) {
      K.push_back(make_pair(ey, ex));
    }
  }
  for (i = 0; i < K.size(); i++) exs[i] = 1;
  for (i = 0; i < K.size(); i++) {
    for (j = i + 1; j < K.size(); j++) {
      if (mult(K[i].first, K[j].second) == mult(K[i].second, K[j].first)) {
        exs[j] = 0;
      }
    }
  }
  int cnt = 0;
  for (i = 0; i < K.size(); i++) {
    cnt += exs[i];
  }
  printf("%d\n", cnt);
  return 0;
}
