You are given a set of n points on the plane. A line containing the origin is called good, if projection of the given set to this line forms a symmetric multiset of points. Find the total number of good lines.

Multiset is a set where equal elements are allowed.

Multiset is called symmetric, if there is a point P on the plane such that the multiset is [centrally symmetric](https://en.wikipedia.org/wiki/Point_reflection) in respect of point P.

Input

The first line contains a single integer n (1 ≤ n ≤ 2000) — the number of points in the set.

Each of the next n lines contains two integers xi and yi ( - 106 ≤ xi, yi ≤ 106) — the coordinates of the points. It is guaranteed that no two points coincide.

Output

If there are infinitely many good lines, print -1.

Otherwise, print single integer — the number of good lines.

Examples

Input

3
1 2
2 1
3 3


Output

3


Input

2
4 3
1 2


Output

-1

Note

Picture to the first sample test:

<image>

In the second sample, any line containing the origin is good.
#include <bits/stdc++.h>
using namespace std;
const long double pi = acosl(-1);
const int maxn = 2010;
const long long mod = 1e9 + 7;
const int inf = 1e9;
const long double eps = 1e-8;
int n;
int x[maxn], y[maxn];
int gone[maxn];
long double X, Y;
vector<pair<long double, long double> > ans;
int dcmp(long double x) {
  if (x > eps) return 1;
  if (x < -eps) return -1;
  return 0;
}
bool check(long double dx, long double dy) {
  long double len = sqrt(dx * dx + dy * dy);
  dx /= len, dy /= len;
  vector<long double> vec;
  for (int i = 0; i < n; i++)
    if (!gone[i]) {
      vec.push_back(x[i] * dx + y[i] * dy);
    }
  sort(vec.begin(), vec.end());
  long double c = X * dx + Y * dy;
  int half = vec.size() / 2;
  int Size = vec.size() - 1;
  for (int i = 0; i < half; i++)
    if (dcmp(vec[i] + vec[Size - i] - 2 * c)) {
      return 0;
    }
  Size++;
  if (half * 2 < Size && dcmp(vec[half] - c)) return 0;
  if (dcmp(dx) < 0)
    dx = -dx, dy = -dy;
  else if (dcmp(dx) == 0)
    dy = 1;
  ans.push_back({dx, dy});
  return 1;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d%d", &x[i], &y[i]), X += x[i], Y += y[i];
  X /= n, Y /= n;
  int num = n;
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++) {
      if (!gone[i] && dcmp(x[i] - X) == 0 && dcmp(y[i] - Y) == 0) {
        gone[i] = 1;
        num--;
      }
      if (gone[i] || gone[j]) continue;
      if (dcmp(x[i] + x[j] - 2 * X) == 0 && dcmp(y[i] + y[j] - 2 * Y) == 0) {
        gone[i] = gone[j] = 1;
        num -= 2;
      }
    }
  if (num <= 1) {
    printf("-1\n");
    return 0;
  }
  if (num & 1) {
    for (int i = 0; i < n; i++)
      if (!gone[i]) {
        long double dx = x[i] - X, dy = y[i] - Y;
        check(-dy, dx);
      }
  } else {
    int j = 0;
    while (gone[j]) j++;
    for (int i = j + 1; i < n; i++)
      if (!gone[i]) {
        long double midx = (long double)(x[i] + x[j]) / 2;
        long double midy = (long double)(y[i] + y[j]) / 2;
        long double dx = midx - X, dy = midy - Y;
        check(-dy, dx);
      }
  }
  int cnt = 0;
  for (int i = 0; i < ans.size(); i++) {
    bool ok = 1;
    for (int j = 0; j < i; j++) {
      if (dcmp(ans[i].first - ans[j].first) == 0 &&
          dcmp(ans[i].second - ans[j].second) == 0) {
        ok = 0;
        break;
      }
    }
    cnt += ok;
  }
  printf("%d", cnt);
  return 0;
}
