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;
long long gcd(long long a, long long b) {
  while (b) {
    a %= b;
    swap(a, b);
  }
  return a;
}
bool cmp(pair<long long, long long> a, pair<long long, long long> b) {
  if (a.first != b.first) return a.first < b.first;
  return a.second < b.second;
}
long long x[2000], y[2000], _x[2000], _y[2000];
long long dst[2000];
bool exs[2000];
int KN;
pair<long long, long long> K[2000];
int main() {
  int n, i, j;
  scanf("%d", &n);
  long long cx = 0, cy = 0;
  for (i = 0; i < n; i++) {
    scanf("%lld%lld", x + i, y + i);
    cx += x[i], cy += y[i];
    _x[i] = x[i], _y[i] = y[i];
    x[i] *= n, y[i] *= n;
  }
  for (i = 0; i < n; i++) {
    exs[i] = 1;
    x[i] -= cx, y[i] -= cy;
    if (x[i] == 0 && y[i] == 0) exs[i] = 0;
  }
  for (i = 0; i < n; i++) {
    if (exs[i] == 0) continue;
    for (j = i + 1; j < n; j++) {
      if (exs[j] == 0) continue;
      if (x[i] == -x[j] && y[i] == -y[j]) {
        exs[i] = exs[j] = 0;
        break;
      }
    }
  }
  for (i = 0, j = 0; i < n; i++) {
    if (exs[i]) {
      x[j] = x[i];
      y[j] = y[i];
      _x[j] = _x[i];
      _y[j] = _y[i];
      j++;
    }
  }
  n = j;
  if (n == 0) {
    printf("-1\n");
    return 0;
  }
  KN = 0;
  for (i = 0; i < n; i++) {
    long long ex = y[0] + y[i];
    long long ey = -x[0] - x[i];
    for (j = 0; j < n; j++) {
      dst[j] = ex * _x[j] + ey * _y[j];
    }
    sort(dst, dst + n);
    bool suc = true;
    long long dc2 = dst[0] + dst[n - 1];
    for (j = 0; j <= (n - 1) / 2; j++) {
      if (dst[j] + dst[n - 1 - j] != dc2) {
        suc = false;
        break;
      }
    }
    if (suc) {
      long long d = gcd(ex, ey);
      ex /= d, ey /= d;
      if (ey < 0 || (ey == 0 && ex < 0)) {
        ex = -ex, ey = -ey;
      }
      K[KN++] = make_pair(ex, ey);
    }
  }
  sort(K, K + KN, cmp);
  for (i = 0, j = 0; i < KN; i++) {
    if (i == 0 || K[i] != K[i - 1]) {
      j++;
    }
  }
  printf("%d\n", j);
  return 0;
}
