#include <bits/stdc++.h>
using namespace std;
const long long inf = 0x3f3f3f3f;
inline long long read() {
  long long x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9')
    x = (x << 3) + (x << 1) + (c ^ 48), c = getchar();
  return x * f;
}
long long x[2010], y[2010], lin[4000010], n = read(), m = 1, dx, dy, ans;
bool vis[2010];
map<pair<long long, long long>, long long> bj;
inline long long gcd(long long a, long long b) {
  return b == 0 ? a : gcd(b, a % b);
}
inline bool jud(long long l, long long r) {
  while (l <= r && lin[l++] == -lin[r--])
    ;
  if (l > r) return 1;
  return 0;
}
signed main() {
  for (register long long i = 1; i <= n; ++i)
    x[i] = read(), y[i] = read(), dx += x[i], dy += y[i], x[i] *= n, y[i] *= n;
  for (register long long i = 1; i <= n; ++i)
    for (register long long j = i; j <= n; ++j)
      if ((dx << 1) == x[i] + x[j])
        if ((dy << 1) == y[i] + y[j]) vis[i] = vis[j] = 1;
  for (register long long i = 1; i <= n; ++i)
    if (!vis[i]) x[m] = x[i], y[m++] = y[i];
  if (m == 1)
    return puts("-1") % 1;
  else
    --m;
  for (register long long i = 1; i <= m; ++i) x[i] -= dx, y[i] -= dy;
  for (register long long i = 1, tx, ty, t; i <= m; ++i) {
    tx = x[i] + x[1], ty = y[i] + y[1], t = gcd(tx, ty), tx /= t, ty /= t,
    dx = -ty, dy = tx;
    if (bj[make_pair(dx, dy)]) continue;
    for (register long long j = 1; j <= m; ++j) lin[j] = dx * x[j] + dy * y[j];
    sort(lin + 1, lin + m + 1);
    if (jud(1, m)) ans++, bj[make_pair(dx, dy)] = 1;
  }
  return printf("%lld\n", ans) % 1;
}
