#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const double eps = 1e-8;
struct pt {
  double x, y, k;
  int px, py;
} a[2010 * 2010];
int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int x[2010], y[2010], p[2010], vis[2010], px[2010], py[2010];
double mx, my;
inline bool cmp(const pt &x, const pt &y) { return x.k < y.k; }
inline bool operator==(const pt &x, const pt &y) {
  return x.x * y.y == x.y * y.x;
}
inline bool equal(int x, double a, double b) {
  double dx = my - py[x], dy = -mx + px[x];
  return fabs(dy * a - b * dx) < eps;
}
signed main() {
  int n = read();
  for (int i = 1; i <= n; ++i) mx += (x[i] = read()), my += (y[i] = read());
  mx /= n;
  my /= n;
  for (int i = 1; i < n; ++i) {
    if (!vis[i]) {
      for (int j = i + 1; j <= n; ++j) {
        if (!vis[j] && fabs(x[i] + x[j] - 2 * mx) < eps &&
            fabs(y[i] + y[j] - 2 * my) < eps) {
          vis[i] = vis[j] = 1;
          break;
        }
      }
    }
  }
  int tot = 0;
  for (int i = 1; i <= n; ++i) {
    if (!vis[i]) {
      px[++tot] = x[i];
      py[tot] = y[i];
    }
  }
  if (tot < 2) {
    puts("-1");
    return 0;
  }
  int cnt = 0;
  for (int i = 1; i < tot; ++i) {
    for (int j = i + 1; j <= tot; ++j) {
      double dx = my - (py[i] + py[j]) / 2.0;
      double dy = -mx + (px[i] + px[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 + 1 + cnt, cmp);
  int lst = 1, pos = 0, ans = 0;
  for (int i = 1; i <= cnt; ++i) {
    if (i == cnt || !(a[i] == a[i + 1])) {
      if (i - lst + 1 >= tot / 2) {
        for (int j = 1; j <= tot; ++j) p[j] = 1;
        while (lst <= i) {
          if (p[a[lst].px] && p[a[lst].py]) {
            p[a[lst].px] = p[a[lst].py] = 0;
          }
          lst++;
        }
        int k = 0;
        for (int j = 1; j <= tot; ++j) {
          if (p[j]) k++, pos = j;
        }
        if (k > (tot & 1)) continue;
        if (!k || equal(pos, a[i].x, a[i].y)) ans++;
      }
      lst = i + 1;
    }
  }
  cout << ans << endl;
  return 0;
}

### Prompt

Construct a Cpp code solution to the problem outlined:

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;
struct pt {
  double x, y, k;
  int px, py;
} a[2010 * 2010];
int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int x[2010], y[2010], p[2010], vis[2010], px[2010], py[2010];
double mx, my;
inline bool cmp(const pt &x, const pt &y) { return x.k < y.k; }
inline bool operator==(const pt &x, const pt &y) {
  return x.x * y.y == x.y * y.x;
}
inline bool equal(int x, double a, double b) {
  double dx = my - py[x], dy = -mx + px[x];
  return fabs(dy * a - b * dx) < eps;
}
signed main() {
  int n = read();
  for (int i = 1; i <= n; ++i) mx += (x[i] = read()), my += (y[i] = read());
  mx /= n;
  my /= n;
  for (int i = 1; i < n; ++i) {
    if (!vis[i]) {
      for (int j = i + 1; j <= n; ++j) {
        if (!vis[j] && fabs(x[i] + x[j] - 2 * mx) < eps &&
            fabs(y[i] + y[j] - 2 * my) < eps) {
          vis[i] = vis[j] = 1;
          break;
        }
      }
    }
  }
  int tot = 0;
  for (int i = 1; i <= n; ++i) {
    if (!vis[i]) {
      px[++tot] = x[i];
      py[tot] = y[i];
    }
  }
  if (tot < 2) {
    puts("-1");
    return 0;
  }
  int cnt = 0;
  for (int i = 1; i < tot; ++i) {
    for (int j = i + 1; j <= tot; ++j) {
      double dx = my - (py[i] + py[j]) / 2.0;
      double dy = -mx + (px[i] + px[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 + 1 + cnt, cmp);
  int lst = 1, pos = 0, ans = 0;
  for (int i = 1; i <= cnt; ++i) {
    if (i == cnt || !(a[i] == a[i + 1])) {
      if (i - lst + 1 >= tot / 2) {
        for (int j = 1; j <= tot; ++j) p[j] = 1;
        while (lst <= i) {
          if (p[a[lst].px] && p[a[lst].py]) {
            p[a[lst].px] = p[a[lst].py] = 0;
          }
          lst++;
        }
        int k = 0;
        for (int j = 1; j <= tot; ++j) {
          if (p[j]) k++, pos = j;
        }
        if (k > (tot & 1)) continue;
        if (!k || equal(pos, a[i].x, a[i].y)) ans++;
      }
      lst = i + 1;
    }
  }
  cout << ans << endl;
  return 0;
}

```