#include <bits/stdc++.h>
using namespace std;
const long double eps = 1e-8;
long long T, n;
long long x[2010], y[2010];
multiset<pair<long long, long long> > Set;
multiset<pair<long long, long long> >::iterator it;
long double s[2010 * 2010], tmp[2010];
long long tot;
long long ans;
long double a, b;
void work(long double k) {
  for (long long i = 1; i <= n; i++)
    tmp[i] = (y[i] - b / 2.0) * k + x[i] - a / 2.0;
  sort(tmp + 1, tmp + n + 1);
  for (long long i = 1; i <= (n + 1) / 2; i++)
    if (fabs(tmp[i] + tmp[n - i + 1]) > eps) return;
  ans++;
}
void work2() {
  for (long long i = 1; i <= n; i++) tmp[i] = y[i];
  sort(tmp + 1, tmp + n + 1);
  long double gg = (tmp[1] + tmp[n]) / 2.0;
  for (long long i = 1; i <= (n + 1) / 2; i++)
    if (fabs((tmp[i] + tmp[n - i + 1]) / 2.0 - gg) > eps) return;
  ans++;
}
signed main() {
  scanf("%lld", &n);
  long long sumx = 0, sumy = 0;
  tot = 0;
  ans = 0;
  for (long long i = 1; i <= n; i++) {
    scanf("%lld%lld", &x[i], &y[i]);
    sumx += x[i], sumy += y[i];
  }
  a = sumx * 2.0 / n, b = sumy * 2.0 / n;
  for (long long i = 1; i <= n; i++) {
    for (long long j = i + 1; j <= n; j++) {
      if (fabs(y[i] + y[j] - b) < eps) continue;
      s[++tot] = -(x[i] + x[j] - a) * 1.0 / (y[i] + y[j] - b);
    }
  }
  sort(s + 1, s + tot + 1);
  if ((sumx * 2) % n == 0 && (sumy * 2) % n == 0) {
    Set.clear();
    long long g1 = sumx * 2 / n, g2 = sumy * 2 / n;
    for (long long i = 1; i <= n; i++) {
      it = Set.lower_bound(pair<long long, long long>(g1 - x[i], g2 - y[i]));
      if (it != Set.end() && (*it).first == g1 - x[i] &&
          (*it).second == g2 - y[i])
        Set.erase(it);
      else
        Set.insert(pair<long long, long long>(x[i], y[i]));
    }
    if (n % 2 == 1 && g1 % 2 == 0 && g2 % 2 == 0) {
      it = Set.lower_bound(pair<long long, long long>(g1 / 2, g2 / 2));
      if (it != Set.end() && (*it).first == g1 / 2 && (*it).second == g2 / 2)
        Set.erase(it);
    }
    n = 0;
    for (it = Set.begin(); it != Set.end(); it++) {
      x[++n] = (*it).first, y[n] = (*it).second;
    }
    if (!n) {
      printf("-1\n");
      return 0;
    }
  }
  work2();
  long long num = 1;
  for (long long i = 2; i <= tot; i++) {
    if (fabs(s[i] - s[i - 1]) < eps)
      num++;
    else {
      if (num >= n / 2) work(s[i - 1]);
      num = 1;
    }
  }
  if (num >= n / 2) work(s[tot]);
  printf("%lld\n", ans);
  return 0;
}

### Prompt

Generate 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;
const long double eps = 1e-8;
long long T, n;
long long x[2010], y[2010];
multiset<pair<long long, long long> > Set;
multiset<pair<long long, long long> >::iterator it;
long double s[2010 * 2010], tmp[2010];
long long tot;
long long ans;
long double a, b;
void work(long double k) {
  for (long long i = 1; i <= n; i++)
    tmp[i] = (y[i] - b / 2.0) * k + x[i] - a / 2.0;
  sort(tmp + 1, tmp + n + 1);
  for (long long i = 1; i <= (n + 1) / 2; i++)
    if (fabs(tmp[i] + tmp[n - i + 1]) > eps) return;
  ans++;
}
void work2() {
  for (long long i = 1; i <= n; i++) tmp[i] = y[i];
  sort(tmp + 1, tmp + n + 1);
  long double gg = (tmp[1] + tmp[n]) / 2.0;
  for (long long i = 1; i <= (n + 1) / 2; i++)
    if (fabs((tmp[i] + tmp[n - i + 1]) / 2.0 - gg) > eps) return;
  ans++;
}
signed main() {
  scanf("%lld", &n);
  long long sumx = 0, sumy = 0;
  tot = 0;
  ans = 0;
  for (long long i = 1; i <= n; i++) {
    scanf("%lld%lld", &x[i], &y[i]);
    sumx += x[i], sumy += y[i];
  }
  a = sumx * 2.0 / n, b = sumy * 2.0 / n;
  for (long long i = 1; i <= n; i++) {
    for (long long j = i + 1; j <= n; j++) {
      if (fabs(y[i] + y[j] - b) < eps) continue;
      s[++tot] = -(x[i] + x[j] - a) * 1.0 / (y[i] + y[j] - b);
    }
  }
  sort(s + 1, s + tot + 1);
  if ((sumx * 2) % n == 0 && (sumy * 2) % n == 0) {
    Set.clear();
    long long g1 = sumx * 2 / n, g2 = sumy * 2 / n;
    for (long long i = 1; i <= n; i++) {
      it = Set.lower_bound(pair<long long, long long>(g1 - x[i], g2 - y[i]));
      if (it != Set.end() && (*it).first == g1 - x[i] &&
          (*it).second == g2 - y[i])
        Set.erase(it);
      else
        Set.insert(pair<long long, long long>(x[i], y[i]));
    }
    if (n % 2 == 1 && g1 % 2 == 0 && g2 % 2 == 0) {
      it = Set.lower_bound(pair<long long, long long>(g1 / 2, g2 / 2));
      if (it != Set.end() && (*it).first == g1 / 2 && (*it).second == g2 / 2)
        Set.erase(it);
    }
    n = 0;
    for (it = Set.begin(); it != Set.end(); it++) {
      x[++n] = (*it).first, y[n] = (*it).second;
    }
    if (!n) {
      printf("-1\n");
      return 0;
    }
  }
  work2();
  long long num = 1;
  for (long long i = 2; i <= tot; i++) {
    if (fabs(s[i] - s[i - 1]) < eps)
      num++;
    else {
      if (num >= n / 2) work(s[i - 1]);
      num = 1;
    }
  }
  if (num >= n / 2) work(s[tot]);
  printf("%lld\n", ans);
  return 0;
}

```