#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const double eps = 1e-8;
const int N = 2005;
struct node {
  double x, y, k;
  int px, py;
} a[N * N];
double mid_x, mid_y;
int n, x[N], y[N], ans, k, t, p[N], die[N], X[N], Y[N], cnt, lst, pos;
bool cmp(const node &A, const node &B) { return A.k < B.k; }
bool operator==(const node &A, const node &B) { return A.x * B.y == A.y * B.x; }
bool check(int x, double b1, double b2) {
  double dx = mid_y - Y[x], dy = -mid_x + X[x];
  return fabs(dy * b1 - b2 * dx) < eps;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++)
    scanf("%d%d", &x[i], &y[i]), mid_x += x[i], mid_y += y[i];
  mid_x /= n;
  mid_y /= n;
  for (int i = 1; i < n; i++)
    if (!die[i])
      for (int j = i + 1; j <= n; j++)
        if (!die[j] && fabs(x[i] + x[j] - 2 * mid_x) < eps &&
            fabs(y[i] + y[j] - 2 * mid_y) < eps) {
          die[i] = die[j] = 1;
          break;
        }
  for (int i = 1; i <= n; i++)
    if (!die[i]) X[++t] = x[i], Y[t] = y[i];
  if (t < 2) return puts("-1"), 0;
  for (int i = 1; i < t; i++)
    for (int j = i + 1; j <= t; j++) {
      double dx = mid_y - (Y[i] + Y[j]) / 2.0,
             dy = -mid_x + (X[i] + X[j]) / 2.0;
      if (dx < 0) dx = -dx, dy = -dy;
      if (dx == 0) dy = fabs(dy);
      if (dy == 0) dx = fabs(dx);
      a[++cnt].x = dx, a[cnt].y = dy;
      a[cnt].px = i;
      a[cnt].py = j;
      a[cnt].k = atan2(dy, dx);
    }
  sort(a + 1, a + cnt + 1, cmp);
  lst = 1;
  for (int i = 1; i <= cnt; i++)
    if (i == cnt || !(a[i] == a[i + 1])) {
      if (i - lst + 1 >= t / 2) {
        for (int j = 1; j <= t; j++) p[j] = 1;
        for (; lst <= i; lst++)
          if (p[a[lst].px] && p[a[lst].py]) p[a[lst].px] = p[a[lst].py] = 0;
        pos = 0;
        for (int j = 1; j <= t; j++)
          if (p[j]) pos = j;
        if (!pos || check(pos, a[i].x, a[i].y)) ans++;
      }
      lst = i + 1;
    }
  printf("%d\n", ans);
  return 0;
}

### Prompt

In CPP, your task is to solve 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;
const int inf = 0x3f3f3f3f;
const double eps = 1e-8;
const int N = 2005;
struct node {
  double x, y, k;
  int px, py;
} a[N * N];
double mid_x, mid_y;
int n, x[N], y[N], ans, k, t, p[N], die[N], X[N], Y[N], cnt, lst, pos;
bool cmp(const node &A, const node &B) { return A.k < B.k; }
bool operator==(const node &A, const node &B) { return A.x * B.y == A.y * B.x; }
bool check(int x, double b1, double b2) {
  double dx = mid_y - Y[x], dy = -mid_x + X[x];
  return fabs(dy * b1 - b2 * dx) < eps;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++)
    scanf("%d%d", &x[i], &y[i]), mid_x += x[i], mid_y += y[i];
  mid_x /= n;
  mid_y /= n;
  for (int i = 1; i < n; i++)
    if (!die[i])
      for (int j = i + 1; j <= n; j++)
        if (!die[j] && fabs(x[i] + x[j] - 2 * mid_x) < eps &&
            fabs(y[i] + y[j] - 2 * mid_y) < eps) {
          die[i] = die[j] = 1;
          break;
        }
  for (int i = 1; i <= n; i++)
    if (!die[i]) X[++t] = x[i], Y[t] = y[i];
  if (t < 2) return puts("-1"), 0;
  for (int i = 1; i < t; i++)
    for (int j = i + 1; j <= t; j++) {
      double dx = mid_y - (Y[i] + Y[j]) / 2.0,
             dy = -mid_x + (X[i] + X[j]) / 2.0;
      if (dx < 0) dx = -dx, dy = -dy;
      if (dx == 0) dy = fabs(dy);
      if (dy == 0) dx = fabs(dx);
      a[++cnt].x = dx, a[cnt].y = dy;
      a[cnt].px = i;
      a[cnt].py = j;
      a[cnt].k = atan2(dy, dx);
    }
  sort(a + 1, a + cnt + 1, cmp);
  lst = 1;
  for (int i = 1; i <= cnt; i++)
    if (i == cnt || !(a[i] == a[i + 1])) {
      if (i - lst + 1 >= t / 2) {
        for (int j = 1; j <= t; j++) p[j] = 1;
        for (; lst <= i; lst++)
          if (p[a[lst].px] && p[a[lst].py]) p[a[lst].px] = p[a[lst].py] = 0;
        pos = 0;
        for (int j = 1; j <= t; j++)
          if (p[j]) pos = j;
        if (!pos || check(pos, a[i].x, a[i].y)) ans++;
      }
      lst = i + 1;
    }
  printf("%d\n", ans);
  return 0;
}

```