#include <bits/stdc++.h>
using namespace std;
const int N = 2e3 + 5, M = N * N;
const double eps = 1e-6;
struct P {
  double x, y;
  P(double _x = 0, double _y = 0) {
    x = _x;
    y = _y;
  }
  friend P operator+(P a, P b) { return P(a.x + b.x, a.y + b.y); }
  friend P operator-(P a, P b) { return P(a.x - b.x, a.y - b.y); }
  friend P operator*(P a, double x) { return P(a.x * x, a.y * x); }
} p[N], q[N], h;
int n, tot, ans;
bool vis[N];
struct node {
  P p;
  int a, b;
  double k;
} a[N * N];
bool cmp(node a, node b) { return a.k < b.k; }
double cross(P a, P b) { return a.x * b.y - a.y * b.x; }
double dot(P a, P b) { return a.x * b.x + a.y * b.y; }
double len(P a) { return sqrt(dot(a, a)); }
int sgn(double x) {
  if (fabs(x) < eps) return 0;
  if (x > 0) return 1;
  return -1;
}
bool check(node L, P p) { return fabs(dot(p - h, L.p)) < eps; }
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%lf%lf", &q[i].x, &q[i].y);
    h = h + q[i];
  }
  h = h * (1.0 / n);
  for (int i = 1; i <= n - 1; i++)
    for (int j = i + 1; j <= n; j++)
      if (!sgn(cross(q[i] - h, q[j] - h)) &&
          fabs(len(q[i] - h) - len(q[j] - h)) < eps) {
        vis[i] = vis[j] = 1;
        continue;
      }
  int tmp = 0;
  for (int i = 1; i <= n; i++)
    if (!vis[i]) p[++tmp] = q[i];
  n = tmp;
  if (n <= 2) {
    puts("-1");
    return 0;
  }
  for (int i = 1; i <= n - 1; i++)
    for (int j = i + 1; j <= n; j++) {
      double x = p[i].x + p[j].x - 2 * h.x;
      double y = p[i].y + p[j].y - 2 * h.y;
      a[++tot].p.x = y;
      a[tot].p.y = -x;
      a[tot].a = i;
      a[tot].b = j;
      if (a[tot].p.x < 0) a[tot].p.x = -a[tot].p.x, a[tot].p.y = -a[tot].p.y;
      if (fabs(a[tot].p.x) < eps) a[tot].p.y = fabs(a[tot].p.y);
      if (fabs(a[tot].p.y) < eps) a[tot].p.x = fabs(a[tot].p.x);
      a[tot].k = atan2(a[tot].p.y, a[tot].p.x);
    }
  sort(a + 1, a + tot + 1, cmp);
  for (int l = 1, r = 0; l <= tot; l = r + 1) {
    while (r < tot && !sgn(cross(a[r + 1].p, a[l].p))) r++;
    if (r - l + 1 >= n / 2) {
      for (int i = 1; i <= n; i++) vis[i] = 0;
      for (int i = l; i <= r; i++)
        if (!vis[a[i].a] && !vis[a[i].b]) vis[a[i].a] = vis[a[i].b] = 1;
      int cnt = 0, id = 0;
      for (int i = 1; i <= n; i++)
        if (!vis[i]) {
          cnt++;
          id = i;
        }
      if (cnt > 0 && !(n & 1) || cnt > 1 && (n & 1)) continue;
      if (!cnt || check(a[l], p[id])) {
        ans++;
        if (n == 1000) printf("%.8lf %.8lf\n", a[l].p.x, a[l].p.y);
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}

### Prompt

Please create a solution in CPP 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;
const int N = 2e3 + 5, M = N * N;
const double eps = 1e-6;
struct P {
  double x, y;
  P(double _x = 0, double _y = 0) {
    x = _x;
    y = _y;
  }
  friend P operator+(P a, P b) { return P(a.x + b.x, a.y + b.y); }
  friend P operator-(P a, P b) { return P(a.x - b.x, a.y - b.y); }
  friend P operator*(P a, double x) { return P(a.x * x, a.y * x); }
} p[N], q[N], h;
int n, tot, ans;
bool vis[N];
struct node {
  P p;
  int a, b;
  double k;
} a[N * N];
bool cmp(node a, node b) { return a.k < b.k; }
double cross(P a, P b) { return a.x * b.y - a.y * b.x; }
double dot(P a, P b) { return a.x * b.x + a.y * b.y; }
double len(P a) { return sqrt(dot(a, a)); }
int sgn(double x) {
  if (fabs(x) < eps) return 0;
  if (x > 0) return 1;
  return -1;
}
bool check(node L, P p) { return fabs(dot(p - h, L.p)) < eps; }
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%lf%lf", &q[i].x, &q[i].y);
    h = h + q[i];
  }
  h = h * (1.0 / n);
  for (int i = 1; i <= n - 1; i++)
    for (int j = i + 1; j <= n; j++)
      if (!sgn(cross(q[i] - h, q[j] - h)) &&
          fabs(len(q[i] - h) - len(q[j] - h)) < eps) {
        vis[i] = vis[j] = 1;
        continue;
      }
  int tmp = 0;
  for (int i = 1; i <= n; i++)
    if (!vis[i]) p[++tmp] = q[i];
  n = tmp;
  if (n <= 2) {
    puts("-1");
    return 0;
  }
  for (int i = 1; i <= n - 1; i++)
    for (int j = i + 1; j <= n; j++) {
      double x = p[i].x + p[j].x - 2 * h.x;
      double y = p[i].y + p[j].y - 2 * h.y;
      a[++tot].p.x = y;
      a[tot].p.y = -x;
      a[tot].a = i;
      a[tot].b = j;
      if (a[tot].p.x < 0) a[tot].p.x = -a[tot].p.x, a[tot].p.y = -a[tot].p.y;
      if (fabs(a[tot].p.x) < eps) a[tot].p.y = fabs(a[tot].p.y);
      if (fabs(a[tot].p.y) < eps) a[tot].p.x = fabs(a[tot].p.x);
      a[tot].k = atan2(a[tot].p.y, a[tot].p.x);
    }
  sort(a + 1, a + tot + 1, cmp);
  for (int l = 1, r = 0; l <= tot; l = r + 1) {
    while (r < tot && !sgn(cross(a[r + 1].p, a[l].p))) r++;
    if (r - l + 1 >= n / 2) {
      for (int i = 1; i <= n; i++) vis[i] = 0;
      for (int i = l; i <= r; i++)
        if (!vis[a[i].a] && !vis[a[i].b]) vis[a[i].a] = vis[a[i].b] = 1;
      int cnt = 0, id = 0;
      for (int i = 1; i <= n; i++)
        if (!vis[i]) {
          cnt++;
          id = i;
        }
      if (cnt > 0 && !(n & 1) || cnt > 1 && (n & 1)) continue;
      if (!cnt || check(a[l], p[id])) {
        ans++;
        if (n == 1000) printf("%.8lf %.8lf\n", a[l].p.x, a[l].p.y);
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}

```