#include <bits/stdc++.h>
using namespace std;
const int N = 2e3 + 10;
const long double eps = 0.2, eps2 = 0.0001;
const int INF = (int)1e9 + 2;
const long long LINF = 1e16;
const double PI = acos(-1.0);
int n;
pair<int, int> mas[N];
long long temp[N];
char used[N];
long double cx, cy;
long long Cx, Cy;
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &mas[i].first, &mas[i].second);
    cx += mas[i].first;
    Cx += mas[i].first;
    cy += mas[i].second;
    Cy += mas[i].second;
  }
  cx /= n;
  cy /= n;
  int r = n;
  for (int i = 0; i < n; i++) {
    if (used[i]) {
      continue;
    }
    if ((n * 1LL * mas[i].first - Cx) == 0 &&
        (n * 1LL * mas[i].second - Cy) == 0) {
      used[i] = 1;
      mas[i].first = mas[i].second = INF;
      r--;
      continue;
    }
    for (int j = 0; j < i; j++) {
      if (Cx * 2 - n * 1LL * (mas[i].first + mas[j].first) == 0 &&
          Cy * 2 - n * 1LL * (mas[i].second + mas[j].second) == 0) {
        used[i] = used[j] = 1;
        mas[i].first = mas[i].second = INF;
        mas[j].first = mas[j].second = INF;
        r -= 2;
        break;
      }
    }
  }
  sort(mas, mas + n);
  if (r < 1) {
    printf("-1");
    return 0;
  }
  vector<pair<long long, long long> > ans;
  int sz = 0;
  for (int i = 0; i < r; i++) {
    long long x2 = (mas[0].first + mas[i].first);
    long long y2 = (mas[0].second + mas[i].second);
    long double a = Cx * 2 - x2 * n, b = Cy * 2 - y2 * n;
    for (int j = 0; j < r; j++) {
      long long del = -b * mas[j].first + a * mas[j].second;
      temp[j] = del;
    }
    x2 = temp[0] + temp[i];
    sort(temp, temp + r);
    bool ok = 1;
    long double er = 0;
    for (int j = 0; j < r; j++) {
      long long t = x2 - temp[j] - temp[r - 1 - j];
      if (t != 0) {
        ok = 0;
        break;
      }
    }
    if (ok) {
      long long A = 2 * Cx - n * 1LL * (mas[0].first + mas[i].first);
      long long B = 2 * Cy - n * 1LL * (mas[0].second + mas[i].second);
      if (A < 0) {
        A /= -1;
        B /= -1;
      }
      long long d = gcd(A, B);
      ans.push_back(make_pair(A / d, B / d));
    }
  }
  if (ans.empty()) {
    printf("0");
    return 0;
  }
  sort(ans.begin(), ans.end());
  for (int i = 0; i < ((int)ans.size()) - 1; i++) {
    if ((ans[i].first == ans[i + 1].first) &&
        (ans[i].second == ans[i + 1].second)) {
      sz++;
    }
  }
  printf("%d", ans.size() - sz);
  return 0;
}
