#include <bits/stdc++.h>
inline void read(int& x) {
  x = 0;
  int f = 0;
  char ch = getchar();
  for (; ch < 48 || ch > 57; ch = getchar()) f |= ch == '-';
  for (; ch > 47 && ch < 58; ch = getchar())
    x = (x << 1) + (x << 3) + (ch ^ 48);
  x = f ? ~x + 1 : x;
}
using namespace std;
int del[2005], x[2005], y[2005];
double k[2005 * 2005], sumx, sumy, _x[2005];
bool cmp(double x) { return abs(x) < 1e-9; }
int check(int n, double k) {
  double mid = (sumx + k * sumy) / (k * k + 1);
  for (int i = 1; i <= n; ++i) _x[i] = (x[i] + k * y[i]) / (k * k + 1) - mid;
  sort(_x + 1, _x + n + 1);
  for (int i = 1; i <= n >> 1; ++i)
    if (!cmp(_x[i] + _x[n - i + 1])) return 0;
  return n & 1 ? cmp(_x[n / 2 + 1]) : 1;
}
int line(int n) {
  sort(y + 1, y + n + 1);
  int sum = y[1] + y[n];
  for (int i = 2; i <= n >> 1; ++i)
    if (y[i] + y[n - i + 1] != sum) return 0;
  return n & 1 ? (y[n / 2 + 1] * 2 == sum) : 1;
}
int _main_() {
  int n, _n_ = 0, ans = 0;
  read(n);
  sumx = 0, sumy = 0;
  for (int i = 1; i <= n; ++i)
    read(x[i]), read(y[i]), sumx += x[i], sumy += y[i];
  sumx /= n;
  sumy /= n;
  for (int i = 1; i < n; ++i)
    for (int j = i + 1; j <= n && !del[i]; ++j)
      if (!del[j])
        if (cmp(x[i] + x[j] - 2 * sumx) && cmp(y[i] + y[j] - 2 * sumy))
          del[i] = del[j] = 1;
  for (int i = 1; i <= n; ++i)
    if (!del[i]) x[++_n_] = x[i], y[_n_] = y[i];
  if ((n = _n_) < 2) {
    if (!n) return -1;
    return cmp(x[1] - sumx) && cmp(y[1] - sumy) ? -1 : 0;
  }
  _n_ = 0;
  for (int i = 1; i < n; ++i)
    for (int j = i + 1; j <= n; ++j)
      if (!cmp(y[i] + y[j] - 2 * sumy))
        k[++_n_] = (2 * sumx - x[i] - x[j]) / (y[i] + y[j] - 2 * sumy);
  sort(k + 1, k + _n_ + 1);
  for (int i = 1, j; i <= _n_; i = j) {
    for (j = i + 1; j <= _n_ && cmp(k[i] - k[j]); ++j)
      ;
    if (j - i >= n >> 1) ans += check(n, k[i]);
  }
  return ans + line(n);
}
int main() {
  printf("%d\n", _main_());
  return 0;
}

### Prompt

Your task is to create 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>
inline void read(int& x) {
  x = 0;
  int f = 0;
  char ch = getchar();
  for (; ch < 48 || ch > 57; ch = getchar()) f |= ch == '-';
  for (; ch > 47 && ch < 58; ch = getchar())
    x = (x << 1) + (x << 3) + (ch ^ 48);
  x = f ? ~x + 1 : x;
}
using namespace std;
int del[2005], x[2005], y[2005];
double k[2005 * 2005], sumx, sumy, _x[2005];
bool cmp(double x) { return abs(x) < 1e-9; }
int check(int n, double k) {
  double mid = (sumx + k * sumy) / (k * k + 1);
  for (int i = 1; i <= n; ++i) _x[i] = (x[i] + k * y[i]) / (k * k + 1) - mid;
  sort(_x + 1, _x + n + 1);
  for (int i = 1; i <= n >> 1; ++i)
    if (!cmp(_x[i] + _x[n - i + 1])) return 0;
  return n & 1 ? cmp(_x[n / 2 + 1]) : 1;
}
int line(int n) {
  sort(y + 1, y + n + 1);
  int sum = y[1] + y[n];
  for (int i = 2; i <= n >> 1; ++i)
    if (y[i] + y[n - i + 1] != sum) return 0;
  return n & 1 ? (y[n / 2 + 1] * 2 == sum) : 1;
}
int _main_() {
  int n, _n_ = 0, ans = 0;
  read(n);
  sumx = 0, sumy = 0;
  for (int i = 1; i <= n; ++i)
    read(x[i]), read(y[i]), sumx += x[i], sumy += y[i];
  sumx /= n;
  sumy /= n;
  for (int i = 1; i < n; ++i)
    for (int j = i + 1; j <= n && !del[i]; ++j)
      if (!del[j])
        if (cmp(x[i] + x[j] - 2 * sumx) && cmp(y[i] + y[j] - 2 * sumy))
          del[i] = del[j] = 1;
  for (int i = 1; i <= n; ++i)
    if (!del[i]) x[++_n_] = x[i], y[_n_] = y[i];
  if ((n = _n_) < 2) {
    if (!n) return -1;
    return cmp(x[1] - sumx) && cmp(y[1] - sumy) ? -1 : 0;
  }
  _n_ = 0;
  for (int i = 1; i < n; ++i)
    for (int j = i + 1; j <= n; ++j)
      if (!cmp(y[i] + y[j] - 2 * sumy))
        k[++_n_] = (2 * sumx - x[i] - x[j]) / (y[i] + y[j] - 2 * sumy);
  sort(k + 1, k + _n_ + 1);
  for (int i = 1, j; i <= _n_; i = j) {
    for (j = i + 1; j <= _n_ && cmp(k[i] - k[j]); ++j)
      ;
    if (j - i >= n >> 1) ans += check(n, k[i]);
  }
  return ans + line(n);
}
int main() {
  printf("%d\n", _main_());
  return 0;
}

```