#include <bits/stdc++.h>
using namespace std;
long long ns[2005];
int n;
long long x[2005], y[2005];
int ans = 0;
struct fs {
  long long a, b;
  fs() { a = b = 0; }
  fs(long long x, long long y) {
    a = x, b = y;
    if (b < 0) b = -b, a = -a;
  }
  bool operator<(const fs &x) const { return a * x.b < b * x.a; }
  bool operator==(const fs &x) const { return a * x.b == b * x.a; }
  bool operator>(const fs &x) const { return a * x.b > b * x.a; }
  void otp() { cout << a << "/" << b << endl; }
};
map<fs, int> q;
void judge(long long a, long long b) {
  fs n1 = fs(a, b);
  if (q[n1]) return;
  for (int i = 1; i <= n; i++) ns[i] = x[i] * a + y[i] * b;
  sort(ns + 1, ns + 1 + n);
  long long nsum;
  bool flag = 0;
  for (int i = (n + 1) / 2; i >= 1; i--)
    if ((ns[i] + ns[n + 1 - i]) != nsum && flag)
      return;
    else
      nsum = ns[i] + ns[n + 1 - i], flag = 1;
  ans++;
  q[n1] = 1;
}
bool hv[2005];
fs l[2][2005], r[2][2005];
int flag[2][2005];
long long inf = 2000000005;
int main() {
  scanf("%d", &n);
  long long sum[2] = {0, 0};
  for (int i = 1; i <= n; i++)
    scanf("%I64d%I64d", &x[i], &y[i]), sum[0] += x[i], sum[1] += y[i];
  for (int i = 1; i <= n; i++) hv[i] = 1;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) {
      if (!hv[j] || !hv[i]) continue;
      if ((x[i] + x[j]) * (long long)n != sum[0] * 2) continue;
      if ((y[i] + y[j]) * (long long)n != sum[1] * 2) continue;
      hv[i] = hv[j] = 0;
    }
  int ncnt = 0;
  for (int i = 1; i <= n; i++)
    if (hv[i]) ncnt++, x[ncnt] = x[i], y[ncnt] = y[i];
  sum[0] = sum[1] = 0;
  n = ncnt;
  for (int i = 1; i <= n; i++) sum[0] += x[i], sum[1] += y[i];
  if (n <= 2)
    printf("-1\n");
  else {
    judge(0, 1);
    for (int i = 1; i <= n; i++) {
      flag[0][i] = flag[1][i] = 1;
      l[0][i] = l[1][i] = fs(-inf, 1);
      r[0][i] = r[1][i] = fs(inf, 1);
      for (int j = 1; j <= n; j++) {
        if (j == i) continue;
        fs n1 = fs(x[j] - x[i], y[i] - y[j]);
        if (y[i] == y[j])
          if (x[i] > x[j])
            flag[0][i] = 0;
          else
            flag[1][i] = 0;
        else {
          if (y[i] > y[j]) {
            if (n1 > l[1][i]) l[1][i] = n1;
            if (n1 < r[0][i]) r[0][i] = n1;
          } else {
            if (n1 < r[1][i]) r[1][i] = n1;
            if (n1 > l[0][i]) l[0][i] = n1;
          }
        }
      }
    }
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= n; j++) {
        if (!flag[1][i] || !flag[0][j]) continue;
        fs nl = l[1][i];
        if (nl < l[0][j]) nl = l[0][j];
        fs nr = r[1][i];
        if (nr > r[0][j]) nr = r[0][j];
        if (nl > nr) continue;
        if ((y[i] + y[j]) * n == sum[1] * 2) continue;
        fs ns =
            fs(sum[0] * 2 - (x[i] + x[j]) * n, (y[i] + y[j]) * n - sum[1] * 2);
        if (ns < nl) continue;
        if (ns > nr) continue;
        judge(ns.b, ns.a);
      }
    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;
long long ns[2005];
int n;
long long x[2005], y[2005];
int ans = 0;
struct fs {
  long long a, b;
  fs() { a = b = 0; }
  fs(long long x, long long y) {
    a = x, b = y;
    if (b < 0) b = -b, a = -a;
  }
  bool operator<(const fs &x) const { return a * x.b < b * x.a; }
  bool operator==(const fs &x) const { return a * x.b == b * x.a; }
  bool operator>(const fs &x) const { return a * x.b > b * x.a; }
  void otp() { cout << a << "/" << b << endl; }
};
map<fs, int> q;
void judge(long long a, long long b) {
  fs n1 = fs(a, b);
  if (q[n1]) return;
  for (int i = 1; i <= n; i++) ns[i] = x[i] * a + y[i] * b;
  sort(ns + 1, ns + 1 + n);
  long long nsum;
  bool flag = 0;
  for (int i = (n + 1) / 2; i >= 1; i--)
    if ((ns[i] + ns[n + 1 - i]) != nsum && flag)
      return;
    else
      nsum = ns[i] + ns[n + 1 - i], flag = 1;
  ans++;
  q[n1] = 1;
}
bool hv[2005];
fs l[2][2005], r[2][2005];
int flag[2][2005];
long long inf = 2000000005;
int main() {
  scanf("%d", &n);
  long long sum[2] = {0, 0};
  for (int i = 1; i <= n; i++)
    scanf("%I64d%I64d", &x[i], &y[i]), sum[0] += x[i], sum[1] += y[i];
  for (int i = 1; i <= n; i++) hv[i] = 1;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) {
      if (!hv[j] || !hv[i]) continue;
      if ((x[i] + x[j]) * (long long)n != sum[0] * 2) continue;
      if ((y[i] + y[j]) * (long long)n != sum[1] * 2) continue;
      hv[i] = hv[j] = 0;
    }
  int ncnt = 0;
  for (int i = 1; i <= n; i++)
    if (hv[i]) ncnt++, x[ncnt] = x[i], y[ncnt] = y[i];
  sum[0] = sum[1] = 0;
  n = ncnt;
  for (int i = 1; i <= n; i++) sum[0] += x[i], sum[1] += y[i];
  if (n <= 2)
    printf("-1\n");
  else {
    judge(0, 1);
    for (int i = 1; i <= n; i++) {
      flag[0][i] = flag[1][i] = 1;
      l[0][i] = l[1][i] = fs(-inf, 1);
      r[0][i] = r[1][i] = fs(inf, 1);
      for (int j = 1; j <= n; j++) {
        if (j == i) continue;
        fs n1 = fs(x[j] - x[i], y[i] - y[j]);
        if (y[i] == y[j])
          if (x[i] > x[j])
            flag[0][i] = 0;
          else
            flag[1][i] = 0;
        else {
          if (y[i] > y[j]) {
            if (n1 > l[1][i]) l[1][i] = n1;
            if (n1 < r[0][i]) r[0][i] = n1;
          } else {
            if (n1 < r[1][i]) r[1][i] = n1;
            if (n1 > l[0][i]) l[0][i] = n1;
          }
        }
      }
    }
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= n; j++) {
        if (!flag[1][i] || !flag[0][j]) continue;
        fs nl = l[1][i];
        if (nl < l[0][j]) nl = l[0][j];
        fs nr = r[1][i];
        if (nr > r[0][j]) nr = r[0][j];
        if (nl > nr) continue;
        if ((y[i] + y[j]) * n == sum[1] * 2) continue;
        fs ns =
            fs(sum[0] * 2 - (x[i] + x[j]) * n, (y[i] + y[j]) * n - sum[1] * 2);
        if (ns < nl) continue;
        if (ns > nr) continue;
        judge(ns.b, ns.a);
      }
    printf("%d\n", ans);
  }
  return 0;
}

```