#include <bits/stdc++.h>
using namespace std;
const long long inf = 0x3f3f3f3f;
inline long long read() {
  long long x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9')
    x = (x << 3) + (x << 1) + (c ^ 48), c = getchar();
  return x * f;
}
map<pair<long long, long long>, long long> bj;
long long lin[4000010], n = read(), m = 1, dx, dy, ans;
bool vis[2010];
inline long long gcd(long long a, long long b) {
  return b == 0 ? a : gcd(b, a % b);
}
struct pos {
  long long x, y;
} poi[2010];
inline bool jud(long long l, long long r) {
  while (l <= r && lin[l++] == -lin[r--])
    ;
  return l > r;
}
signed main() {
  for (register long long i = 1; i <= n; ++i)
    poi[i] = (pos){read(), read()}, dx += poi[i].x, dy += poi[i].y,
    poi[i].x *= n, poi[i].y *= n;
  for (register long long i = 1; i <= n; ++i)
    for (register long long j = i; j <= n; ++j)
      if ((dx << 1) == poi[i].x + poi[j].x)
        if ((dy << 1) == poi[i].y + poi[j].y) vis[i] = vis[j] = 1;
  for (register long long i = 1; i <= n; ++i)
    if (!vis[i]) poi[m].x = poi[i].x, poi[m++].y = poi[i].y;
  if (m == 1)
    return puts("-1") % 1;
  else
    --m;
  for (register long long i = 1; i <= m; ++i) poi[i].x -= dx, poi[i].y -= dy;
  for (register long long i = 1, tx, ty, t; i <= m; ++i) {
    tx = poi[i].x + poi[1].x, ty = poi[i].y + poi[1].y, t = gcd(tx, ty),
    tx /= t, ty /= t, dx = -ty, dy = tx;
    if (bj[make_pair(dx, dy)]) continue;
    for (register long long j = 1; j <= m; ++j)
      lin[j] = dx * poi[j].x + dy * poi[j].y;
    sort(lin + 1, lin + m + 1);
    if (jud(1, m)) ans++, bj[make_pair(dx, dy)] = 1;
  }
  return printf("%lld\n", ans) % 1;
}

### Prompt

Please provide a cpp coded solution to the problem described below:

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;
const long long inf = 0x3f3f3f3f;
inline long long read() {
  long long x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9')
    x = (x << 3) + (x << 1) + (c ^ 48), c = getchar();
  return x * f;
}
map<pair<long long, long long>, long long> bj;
long long lin[4000010], n = read(), m = 1, dx, dy, ans;
bool vis[2010];
inline long long gcd(long long a, long long b) {
  return b == 0 ? a : gcd(b, a % b);
}
struct pos {
  long long x, y;
} poi[2010];
inline bool jud(long long l, long long r) {
  while (l <= r && lin[l++] == -lin[r--])
    ;
  return l > r;
}
signed main() {
  for (register long long i = 1; i <= n; ++i)
    poi[i] = (pos){read(), read()}, dx += poi[i].x, dy += poi[i].y,
    poi[i].x *= n, poi[i].y *= n;
  for (register long long i = 1; i <= n; ++i)
    for (register long long j = i; j <= n; ++j)
      if ((dx << 1) == poi[i].x + poi[j].x)
        if ((dy << 1) == poi[i].y + poi[j].y) vis[i] = vis[j] = 1;
  for (register long long i = 1; i <= n; ++i)
    if (!vis[i]) poi[m].x = poi[i].x, poi[m++].y = poi[i].y;
  if (m == 1)
    return puts("-1") % 1;
  else
    --m;
  for (register long long i = 1; i <= m; ++i) poi[i].x -= dx, poi[i].y -= dy;
  for (register long long i = 1, tx, ty, t; i <= m; ++i) {
    tx = poi[i].x + poi[1].x, ty = poi[i].y + poi[1].y, t = gcd(tx, ty),
    tx /= t, ty /= t, dx = -ty, dy = tx;
    if (bj[make_pair(dx, dy)]) continue;
    for (register long long j = 1; j <= m; ++j)
      lin[j] = dx * poi[j].x + dy * poi[j].y;
    sort(lin + 1, lin + m + 1);
    if (jud(1, m)) ans++, bj[make_pair(dx, dy)] = 1;
  }
  return printf("%lld\n", ans) % 1;
}

```