#include <bits/stdc++.h>
using namespace std;
const int N = 2e3 + 5;
const double w = 1e-8;
int n, m, i, j, k, p, q, ans;
double ax, ay;
int x[N], y[N];
struct data {
  double k;
  int x, y;
} a[N * N];
bool bz[N], bzx[N], bzy[N];
bool cmp(data a, data b) { return a.k < b.k; }
bool pd(int i, int j) {
  if (x[i] + x[j] == ax * 2 && y[i] + y[j] == ay * 2) return 1;
  return 0;
}
void get(int i, int j) {
  double x1 = (double)(x[i] + x[j]) / 2, y1 = (double)(y[i] + y[j]) / 2;
  if (fabs(x1 - ax) < w) {
    if (!bzx[i]) p++, bzx[i] = 1;
    if (!bzx[j]) p++, bzx[j] = 1;
    return;
  }
  if (fabs(y1 - ay) < w) {
    if (!bzy[i]) q++, bzy[i] = 1;
    if (!bzy[j]) q++, bzy[j] = 1;
    return;
  }
  a[++m].k = (ay - y1) / (ax - x1), a[m].x = i, a[m].y = j;
}
int main() {
  scanf("%d", &n), ax = ay = 0, p = q = ans = 0;
  for (i = 1; i <= n; i++) scanf("%d%d", &x[i], &y[i]), ax += x[i], ay += y[i];
  ax /= n, ay /= n;
  for (i = 1; i <= n; i++)
    for (j = i + 1; j <= n; j++)
      if (pd(i, j)) bz[i] = bz[j] = 1;
  for (i = 1; i <= n; i++)
    if (x[i] == ax && y[i] == ay) bz[i] = 1;
  m = 0;
  for (i = 1; i <= n; i++)
    if (!bz[i])
      x[++m] = x[i], y[m] = y[i];
    else
      bz[i] = 0;
  n = m, m = 0;
  int n0 = n / 2;
  if (n <= 2) {
    printf("-1\n");
    return 0;
  }
  for (i = 1; i <= n; i++)
    for (j = i + 1; j <= n; j++) get(i, j);
  if (p / 2 >= n0) ans++;
  if (q / 2 >= n0) ans++;
  for (i = 1; i <= n; i++) bzx[i] = bzy[i] = 0;
  sort(a + 1, a + m + 1, cmp);
  int li = 1;
  k = 1, bz[a[1].x] = bz[a[1].y] = 1;
  for (i = 2; i <= m; i++) {
    if (a[i].k - a[i - 1].k > w) {
      if (k >= n0) ans++;
      for (j = li; j <= i - 1; j++) bz[a[j].x] = bz[a[j].y] = 0;
      k = 1, bz[a[i].x] = bz[a[i].y] = 1, li = i;
    } else {
      if (!bz[a[i].x] && !bz[a[i].y]) k++, bz[a[i].x] = bz[a[i].y] = 1;
    }
  }
  if (k >= n0) ans++;
  printf("%d\n", ans);
}
