#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-9;
const int N = 2000;
struct yuurei {
  double x, y;
  yuurei(double x_, double y_) : x(x_), y(y_) {}
  yuurei() { x = 0, y = 0; }
  yuurei operator+(yuurei a) { return yuurei(x + a.x, y + a.y); }
  yuurei operator-(yuurei a) { return yuurei(x - a.x, y - a.y); }
  double operator*(yuurei a) { return x * a.x + y * a.y; }
  yuurei operator/(double a) { return yuurei(x / a, y / a); }
  bool operator==(yuurei a) {
    return fabs(x - a.x) < eps && fabs(y - a.y) < eps;
  }
} p[N + 10], G, mid, vec;
int T, n, x, ans, id[N + 10];
pair<double, int> a[N + 10];
bool check(int pos) {
  mid = (p[x] + p[pos]) / 2;
  vec = G - mid;
  vec = yuurei(vec.y, -vec.x);
  for (int i = 1; i <= n; i++) a[i] = make_pair(vec * p[i], i);
  sort(a + 1, a + n + 1);
  for (int i = 1; i <= n; i++) id[a[i].second] = i;
  if (id[x] + id[pos] != n + 1) return 0;
  double cmp = a[1].first + a[n].first;
  for (int i = 1; i <= n; i++)
    if (fabs(a[i].first + a[n - i + 1].first - cmp) > eps) return 0;
  return 1;
}
int main() {
  scanf("%d", &n);
  G = yuurei(0, 0);
  for (int i = 1; i <= n; i++) {
    double a, b;
    scanf("%lf%lf", &a, &b);
    p[i] = yuurei(a, b);
    G = G + p[i];
  }
  G = G / n;
  x = ans = 0;
  for (int i = 1; i <= n; i++) {
    bool flag = 0;
    for (int j = 1; j <= n; j++)
      if (p[i] + p[j] == G + G) flag = 1;
    if (!flag) x = i;
  }
  if (!x) {
    printf("-1\n");
    return 0;
  }
  for (int i = 1; i <= n; i++)
    if (check(i)) ans++;
  printf("%d\n", ans);
  return 0;
}
