#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long t = 0, dp = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') dp = -1;
    c = getchar();
  }
  while (isdigit(c)) t = t * 10 + c - 48, c = getchar();
  return t * dp;
}
inline void write(long long x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  if (x >= 10) write(x / 10);
  putchar(x % 10 + 48);
}
inline void writeln(long long x) {
  write(x);
  puts("");
}
inline void write_p(long long x) {
  write(x);
  putchar(' ');
}
const int N = 2005;
long long dis[N], n;
int ans = 0;
struct node {
  long long x, y;
} p[N];
inline bool equal(long long x, long long y) { return x == y; }
map<pair<long long, long long>, int> vis;
inline long long gcd(long long x, long long y) {
  return y == 0 ? x : gcd(y, x % y);
}
inline void Solve(int jz, int x) {
  long long tx = -(p[jz].x + p[x].x), ty = p[jz].y + p[x].y;
  swap(tx, ty);
  long long gc = gcd(tx, ty);
  tx /= gc;
  ty /= gc;
  if (vis[make_pair(tx, ty)]) return;
  for (int i = 1; i <= n; ++i) dis[i] = tx * p[i].x + ty * p[i].y;
  sort(dis + 1, dis + n + 1);
  bool ok = 1;
  for (int i = 1; i <= n / 2; ++i)
    if (dis[i] != -dis[n - i + 1]) {
      ok = 0;
      break;
    }
  if (ok) {
    vis[make_pair(tx, ty)] = 1;
    ans++;
  }
}
long long sx, sy;
bool save[N];
int main() {
  n = read();
  if (n == 1) {
    puts("-1");
    return 0;
  }
  for (int i = 1; i <= n; ++i) {
    p[i].x = read();
    p[i].y = read();
    p[i].x *= n;
    p[i].y *= n;
    sx += p[i].x;
    sy += p[i].y;
  }
  sx /= n;
  sy /= n;
  for (int i = 1; i <= n; ++i) save[i] = 1;
  for (int i = 1; i <= n; ++i)
    if (save[i])
      for (int j = i + 1; j <= n; ++j)
        if (equal(2 * sx - p[i].x, p[j].x) && equal(2 * sy - p[i].y, p[j].y))
          save[i] = save[j] = 0;
  int top = 0;
  for (int i = 1; i <= n; ++i)
    if (save[i]) p[++top].x = p[i].x - sx, p[top].y = p[i].y - sy;
  n = top;
  if (!n) {
    puts("-1");
    return 0;
  }
  for (int i = 2; i <= n; ++i) Solve(1, i);
  for (int i = 2; i <= n; ++i)
    if (i != 2) Solve(2, i);
  writeln(ans);
}

### Prompt

Please formulate 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;
inline long long read() {
  long long t = 0, dp = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') dp = -1;
    c = getchar();
  }
  while (isdigit(c)) t = t * 10 + c - 48, c = getchar();
  return t * dp;
}
inline void write(long long x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  if (x >= 10) write(x / 10);
  putchar(x % 10 + 48);
}
inline void writeln(long long x) {
  write(x);
  puts("");
}
inline void write_p(long long x) {
  write(x);
  putchar(' ');
}
const int N = 2005;
long long dis[N], n;
int ans = 0;
struct node {
  long long x, y;
} p[N];
inline bool equal(long long x, long long y) { return x == y; }
map<pair<long long, long long>, int> vis;
inline long long gcd(long long x, long long y) {
  return y == 0 ? x : gcd(y, x % y);
}
inline void Solve(int jz, int x) {
  long long tx = -(p[jz].x + p[x].x), ty = p[jz].y + p[x].y;
  swap(tx, ty);
  long long gc = gcd(tx, ty);
  tx /= gc;
  ty /= gc;
  if (vis[make_pair(tx, ty)]) return;
  for (int i = 1; i <= n; ++i) dis[i] = tx * p[i].x + ty * p[i].y;
  sort(dis + 1, dis + n + 1);
  bool ok = 1;
  for (int i = 1; i <= n / 2; ++i)
    if (dis[i] != -dis[n - i + 1]) {
      ok = 0;
      break;
    }
  if (ok) {
    vis[make_pair(tx, ty)] = 1;
    ans++;
  }
}
long long sx, sy;
bool save[N];
int main() {
  n = read();
  if (n == 1) {
    puts("-1");
    return 0;
  }
  for (int i = 1; i <= n; ++i) {
    p[i].x = read();
    p[i].y = read();
    p[i].x *= n;
    p[i].y *= n;
    sx += p[i].x;
    sy += p[i].y;
  }
  sx /= n;
  sy /= n;
  for (int i = 1; i <= n; ++i) save[i] = 1;
  for (int i = 1; i <= n; ++i)
    if (save[i])
      for (int j = i + 1; j <= n; ++j)
        if (equal(2 * sx - p[i].x, p[j].x) && equal(2 * sy - p[i].y, p[j].y))
          save[i] = save[j] = 0;
  int top = 0;
  for (int i = 1; i <= n; ++i)
    if (save[i]) p[++top].x = p[i].x - sx, p[top].y = p[i].y - sy;
  n = top;
  if (!n) {
    puts("-1");
    return 0;
  }
  for (int i = 2; i <= n; ++i) Solve(1, i);
  for (int i = 2; i <= n; ++i)
    if (i != 2) Solve(2, i);
  writeln(ans);
}

```