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 int _ = 1e2;
const int maxn = 2e3 + _;
inline long long gcd(long long x, long long y) {
  return x == 0 ? y : gcd(y % x, x);
}
struct point {
  long long x, y;
} p[maxn];
bool dl[maxn];
long long mul(point p1, point p2) { return p1.x * p2.x + p1.y * p2.y; }
int len;
long long d[maxn];
map<pair<long long, long long>, bool> mp;
bool check(point p) {
  if (p.x != 0 && p.y != 0) {
    long long g = gcd(p.x, p.y);
    p.x /= g, p.y /= g;
  }
  if (p.x < 0) p.x = -p.x, p.y = -p.y;
  if (p.x == 0) p.y = 1;
  if (p.y == 0) p.x = 1;
  if (mp.count(make_pair(p.x, p.y)))
    return true;
  else {
    mp[make_pair(p.x, p.y)] = true;
    return false;
  }
}
int main() {
  int n, sumx = 0, sumy = 0;
  scanf("%d", &n);
  if (n == 1) {
    puts("-1");
    return 0;
  }
  for (int i = 1; i <= n; i++) {
    scanf("%lld%lld", &p[i].x, &p[i].y);
    sumx += p[i].x;
    sumy += p[i].y;
    p[i].x *= n, p[i].y *= n;
  }
  for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++)
      if (p[i].x + p[j].x == 2 * sumx && p[i].y + p[j].y == 2 * sumy)
        dl[i] = dl[j] = true;
  int tp = 0;
  for (int i = 1; i <= n; i++)
    if (!dl[i]) p[++tp] = p[i], p[tp].x -= sumx, p[tp].y -= sumy;
  n = tp;
  if (n == 0) {
    puts("-1");
    return 0;
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    point u = {p[1].y + p[i].y, -p[1].x - p[i].x};
    if (check(u)) continue;
    len = 0;
    for (int j = 1; j <= n; j++) d[++len] = mul(u, p[j]);
    sort(d + 1, d + len + 1);
    bool bk = false;
    for (int j = 1; j <= (n + 1) / 2; j++)
      if (d[1] + d[n] != d[j] + d[n - j + 1]) {
        bk = true;
        break;
      }
    if (!bk) ans++;
  }
  printf("%d\n", ans);
  return 0;
}
