#include <bits/stdc++.h>
using namespace std;
namespace io {
const int SIZE = 2e6;
char buff[SIZE], *l, *r;
char getch(void) {
  if (l == r) r = (l = buff) + fread(buff, 1, SIZE, stdin);
  return l == r ? EOF : *l++;
}
template <typename T>
void read(T &x) {
  x = 0;
  T tmp = 1;
  char c = getch();
  while ((c < '0' || c > '9') && c != '-') c = getch();
  if (c == '-') tmp = -1, c = getch();
  while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getch();
  x *= tmp;
}
}  // namespace io
using io::read;
const double eps = 1e-8;
inline int fcmp(double x) {
  if (fabs(x) < eps) return 0;
  return x > 0 ? 1 : -1;
}
struct vec {
  double x, y;
  vec() {}
  vec(double _x, double _y) : x(_x), y(_y) {}
  inline bool operator==(const vec &p) const {
    return fcmp(x - p.x) == 0 && fcmp(y - p.y) == 0;
  }
  inline bool operator<(const vec &p) const {
    return fcmp(x - p.x) < 0 || (fcmp(x - p.x) == 0 && fcmp(y - p.y) < 0);
  }
  inline vec operator+(const vec &p) const { return vec(x + p.x, y + p.y); }
  inline vec operator-(const vec &p) const { return vec(x - p.x, y - p.y); }
  inline vec operator*(const double &p) const { return vec(x * p, y * p); }
  inline vec operator/(const double &p) const { return vec(x / p, y / p); }
  inline double operator*(const vec &p) const { return x * p.x + y * p.y; }
  inline double length(void) { return sqrt(x * x + y * y); }
  inline vec unit(void) { return vec(x / length(), y / length()); }
  inline vec norm(void) { return vec(-y, x).unit(); }
};
const int maxn = 2010;
int n, A;
vec a[maxn], G;
bool Solve(int B) {
  vec mv = ((a[A] + a[B]) / (double)2) - G;
  mv = mv.norm();
  static pair<double, int> b[maxn];
  static int pos[maxn];
  for (int i = 1; i <= n; ++i) b[i] = make_pair(mv * a[i], i);
  sort(b + 1, b + 1 + n);
  for (int i = 1; i <= n; ++i) pos[b[i].second] = i;
  if (pos[A] + pos[B] != n + 1) return 0;
  double tmp = b[1].first + b[n].first;
  for (int i = 2; i <= (n >> 1); ++i)
    if (fcmp(b[i].first + b[n - i + 1].first - tmp) != 0) return 0;
  return 1;
}
int main(void) {
  read(n);
  G = vec(0, 0);
  for (int i = 1, x, y; i <= n; ++i) {
    read(x), read(y);
    a[i] = vec(1.0 * x, 1.0 * y);
    G = G + a[i];
  }
  G = G / (double)n;
  bool no_solution = 1;
  for (int i = 1; i <= n; ++i) {
    bool flag = 0;
    for (int j = 1; j <= n; ++j)
      if ((a[i] + a[j]) == (G + G)) flag = 1;
    if (!flag) {
      no_solution = 0;
      A = i;
    }
  }
  if (no_solution) {
    puts("-1");
    return 0;
  }
  int ans = 0;
  for (int i = 1; i <= n; ++i)
    if (Solve(i)) ++ans;
  printf("%d\n", ans);
  return 0;
}
