#include <bits/stdc++.h>
using namespace std;
struct point {
  int x, y;
} p[2020];
int n, sumx, sumy, ans;
bool used[2020];
map<pair<int, int>, vector<int> > mp;
map<pair<long long, long long>, bool> st;
long long pos[2020];
long long gcd(long long a, long long b) {
  if (!a || !b) return a + b;
  return gcd(b, a % b);
}
void check(long long cs, long long sn) {
  long long g = gcd(cs, sn);
  cs /= g, sn /= g;
  if (cs < 0 || (cs == 0 && sn < 0)) cs = -cs, sn = -sn;
  if (st[make_pair(cs, sn)]) return;
  st[make_pair(cs, sn)] = 1;
  if (!cs) {
    for (int i = 1; i <= n; ++i) pos[i] = p[i].y;
    sort(pos + 1, pos + 1 + n);
    for (int i = 2; 2 * i <= n + 1; ++i)
      if (pos[i] + pos[n + 1 - i] != pos[1] + pos[n]) return;
    ++ans;
    return;
  }
  for (int i = 1; i <= n; ++i) pos[i] = p[i].x * cs + p[i].y * sn;
  sort(pos + 1, pos + 1 + n);
  for (int i = 2; 2 * i <= n + 1; ++i)
    if (pos[i] + pos[n + 1 - i] != pos[1] + pos[n]) return;
  ++ans;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i)
    scanf("%d %d", &p[i].x, &p[i].y), sumx += p[i].x, sumy += p[i].y;
  if (2ll * sumx % n == 0 && 2ll * sumy % n == 0) {
    for (int i = 1; i <= n; ++i)
      if (p[i].x * n == sumx && p[i].y * n == sumy)
        used[i] = 1;
      else
        mp[make_pair(p[i].x, p[i].y)].emplace_back(i);
    int mx = 2ll * sumx / n, my = 2ll * sumy / n;
    for (int i = 1; i <= n; ++i)
      if (!used[i]) {
        auto o = make_pair(mx - p[i].x, my - p[i].y);
        if (mp[o].size()) {
          used[i] = 1;
          used[mp[o].back()] = 1;
          mp[o].pop_back();
        }
      }
    int m = 0;
    for (int i = 1; i <= n; ++i)
      if (!used[i]) p[++m] = p[i];
    n = m;
    if (!n) return printf("-1"), 0;
  }
  sumx = sumy = 0;
  for (int i = 1; i <= n; ++i) sumx += p[i].x, sumy += p[i].y;
  for (int i = 1; i <= n; ++i)
    check(1ll * (p[1].y + p[i].y) * n - 2ll * sumy,
          2ll * sumx - 1ll * (p[1].x + p[i].x) * n);
  printf("%d", ans);
  return 0;
}

### Prompt

Your challenge is to write a cpp solution to the following problem:

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.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
struct point {
  int x, y;
} p[2020];
int n, sumx, sumy, ans;
bool used[2020];
map<pair<int, int>, vector<int> > mp;
map<pair<long long, long long>, bool> st;
long long pos[2020];
long long gcd(long long a, long long b) {
  if (!a || !b) return a + b;
  return gcd(b, a % b);
}
void check(long long cs, long long sn) {
  long long g = gcd(cs, sn);
  cs /= g, sn /= g;
  if (cs < 0 || (cs == 0 && sn < 0)) cs = -cs, sn = -sn;
  if (st[make_pair(cs, sn)]) return;
  st[make_pair(cs, sn)] = 1;
  if (!cs) {
    for (int i = 1; i <= n; ++i) pos[i] = p[i].y;
    sort(pos + 1, pos + 1 + n);
    for (int i = 2; 2 * i <= n + 1; ++i)
      if (pos[i] + pos[n + 1 - i] != pos[1] + pos[n]) return;
    ++ans;
    return;
  }
  for (int i = 1; i <= n; ++i) pos[i] = p[i].x * cs + p[i].y * sn;
  sort(pos + 1, pos + 1 + n);
  for (int i = 2; 2 * i <= n + 1; ++i)
    if (pos[i] + pos[n + 1 - i] != pos[1] + pos[n]) return;
  ++ans;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i)
    scanf("%d %d", &p[i].x, &p[i].y), sumx += p[i].x, sumy += p[i].y;
  if (2ll * sumx % n == 0 && 2ll * sumy % n == 0) {
    for (int i = 1; i <= n; ++i)
      if (p[i].x * n == sumx && p[i].y * n == sumy)
        used[i] = 1;
      else
        mp[make_pair(p[i].x, p[i].y)].emplace_back(i);
    int mx = 2ll * sumx / n, my = 2ll * sumy / n;
    for (int i = 1; i <= n; ++i)
      if (!used[i]) {
        auto o = make_pair(mx - p[i].x, my - p[i].y);
        if (mp[o].size()) {
          used[i] = 1;
          used[mp[o].back()] = 1;
          mp[o].pop_back();
        }
      }
    int m = 0;
    for (int i = 1; i <= n; ++i)
      if (!used[i]) p[++m] = p[i];
    n = m;
    if (!n) return printf("-1"), 0;
  }
  sumx = sumy = 0;
  for (int i = 1; i <= n; ++i) sumx += p[i].x, sumy += p[i].y;
  for (int i = 1; i <= n; ++i)
    check(1ll * (p[1].y + p[i].y) * n - 2ll * sumy,
          2ll * sumx - 1ll * (p[1].x + p[i].x) * n);
  printf("%d", ans);
  return 0;
}

```