#include <bits/stdc++.h>
using namespace std;
const int N = 2010;
const double eps = 1e-6;
struct point {
  double x, y;
  point() {}
  point(double x, double y) : x(x), y(y) {}
  point operator+(const point &P) const { return point(x + P.x, y + P.y); }
  point operator-(const point &P) const { return point(x - P.x, y - P.y); }
  point operator*(const double &T) const { return point(x * T, y * T); }
} p[N], q[N], h;
struct line {
  point p;
  int a, b;
  double k;
  bool operator<(const line &L) const { return k < L.k; }
} L[N * N];
int n, tmp, cnt, ans;
double x, y;
bool vis[N];
inline double cross(point A, point B) { return A.x * B.y - B.x * A.y; }
inline double dot(point A, point B) { return A.x * B.x + A.y * B.y; }
inline double len(point A) { return sqrt(dot(A, A)); }
inline int judge(double x) { return fabs(x) < eps ? 0 : (x > 0 ? 1 : -1); }
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%lf%lf", &q[i].x, &q[i].y), h = h + q[i];
  h = h * (1.0 / n);
  for (int i = 1; i < n; i++)
    for (int j = i + 1; j <= n; j++)
      if (!judge(cross(q[i] - h, q[j] - h)) &&
          !judge(len(q[i] - h) - len(q[j] - h)))
        vis[i] = vis[j] = 1;
  for (int i = 1; i <= n; i++)
    if (!vis[i]) p[++tmp] = q[i];
  n = tmp;
  if (tmp <= 2) {
    puts("-1");
    return 0;
  }
  for (int i = 1; i < n; i++)
    for (int j = i + 1; j <= n; j++) {
      x = p[i].x + p[j].x - h.x * 2;
      y = p[i].y + p[j].y - h.y * 2;
      ++cnt;
      L[cnt].p = point(y, -x);
      L[cnt].a = i;
      L[cnt].b = j;
      if (L[cnt].p.x < 0) L[cnt].p.x = -L[cnt].p.x, L[cnt].p.y = -L[cnt].p.y;
      if (fabs(L[cnt].p.x) < eps) L[cnt].p.y = fabs(L[cnt].p.y);
      if (fabs(L[cnt].p.y) < eps) L[cnt].p.x = fabs(L[cnt].p.x);
      L[cnt].k = atan2(L[cnt].p.y, L[cnt].p.x);
    }
  sort(L + 1, L + cnt + 1);
  for (int l = 1, r = 0; l <= cnt; l = r + 1) {
    while (r < cnt && !judge(cross(L[l].p, L[r + 1].p))) r++;
    if (r - l + 1 < n / 2) continue;
    memset(vis, 0, sizeof vis);
    for (int i = l; i <= r; i++)
      if (!vis[L[i].a] && !vis[L[i].b]) vis[L[i].a] = vis[L[i].b] = 1;
    int cnt = 0, id;
    for (int i = 1; i <= n; i++)
      if (!vis[i]) ++cnt, id = i;
    if ((cnt > 0 && !(n & 1)) || ((cnt > 1) && (n & 1))) continue;
    if (!cnt || !judge(dot(p[id] - h, L[l].p))) ans++;
  }
  printf("%d\n", ans);
  return 0;
}
