#include <bits/stdc++.h>
using namespace std;
const int N = 2e3 + 10;
const long double eps = 0.2, eps2 = 0.0001;
const int INF = (int)1e9 + 2;
const long long LINF = 1e16;
const double PI = acos(-1.0);
int n;
pair<int, int> mas[N];
long long temp[N];
char used[N];
long double cx, cy;
long long Cx, Cy;
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &mas[i].first, &mas[i].second);
    cx += mas[i].first;
    Cx += mas[i].first;
    cy += mas[i].second;
    Cy += mas[i].second;
  }
  cx /= n;
  cy /= n;
  int r = n;
  for (int i = 0; i < n; i++) {
    if (used[i]) {
      continue;
    }
    if ((n * 1LL * mas[i].first - Cx) == 0 &&
        (n * 1LL * mas[i].second - Cy) == 0) {
      used[i] = 1;
      mas[i].first = mas[i].second = INF;
      r--;
      continue;
    }
    for (int j = 0; j < i; j++) {
      if (Cx * 2 - n * 1LL * (mas[i].first + mas[j].first) == 0 &&
          Cy * 2 - n * 1LL * (mas[i].second + mas[j].second) == 0) {
        used[i] = used[j] = 1;
        mas[i].first = mas[i].second = INF;
        mas[j].first = mas[j].second = INF;
        r -= 2;
        break;
      }
    }
  }
  sort(mas, mas + n);
  if (r < 1) {
    printf("-1");
    return 0;
  }
  vector<pair<long long, long long> > ans;
  int sz = 0;
  for (int i = 0; i < r; i++) {
    long long x2 = (mas[0].first + mas[i].first);
    long long y2 = (mas[0].second + mas[i].second);
    long double a = Cx * 2 - x2 * n, b = Cy * 2 - y2 * n;
    for (int j = 0; j < r; j++) {
      long long del = -b * mas[j].first + a * mas[j].second;
      temp[j] = del;
    }
    x2 = temp[0] + temp[i];
    sort(temp, temp + r);
    bool ok = 1;
    long double er = 0;
    for (int j = 0; j < r; j++) {
      long long t = x2 - temp[j] - temp[r - 1 - j];
      if (t != 0) {
        ok = 0;
        break;
      }
    }
    if (ok) {
      long long A = 2 * Cx - n * 1LL * (mas[0].first + mas[i].first);
      long long B = 2 * Cy - n * 1LL * (mas[0].second + mas[i].second);
      if (A < 0) {
        A /= -1;
        B /= -1;
      }
      long long d = gcd(A, B);
      ans.push_back(make_pair(A / d, B / d));
    }
  }
  if (ans.empty()) {
    printf("0");
    return 0;
  }
  sort(ans.begin(), ans.end());
  for (int i = 0; i < ((int)ans.size()) - 1; i++) {
    if ((ans[i].first == ans[i + 1].first) &&
        (ans[i].second == ans[i + 1].second)) {
      sz++;
    }
  }
  printf("%d", ans.size() - sz);
  return 0;
}

### Prompt

Your challenge is to write 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 int N = 2e3 + 10;
const long double eps = 0.2, eps2 = 0.0001;
const int INF = (int)1e9 + 2;
const long long LINF = 1e16;
const double PI = acos(-1.0);
int n;
pair<int, int> mas[N];
long long temp[N];
char used[N];
long double cx, cy;
long long Cx, Cy;
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &mas[i].first, &mas[i].second);
    cx += mas[i].first;
    Cx += mas[i].first;
    cy += mas[i].second;
    Cy += mas[i].second;
  }
  cx /= n;
  cy /= n;
  int r = n;
  for (int i = 0; i < n; i++) {
    if (used[i]) {
      continue;
    }
    if ((n * 1LL * mas[i].first - Cx) == 0 &&
        (n * 1LL * mas[i].second - Cy) == 0) {
      used[i] = 1;
      mas[i].first = mas[i].second = INF;
      r--;
      continue;
    }
    for (int j = 0; j < i; j++) {
      if (Cx * 2 - n * 1LL * (mas[i].first + mas[j].first) == 0 &&
          Cy * 2 - n * 1LL * (mas[i].second + mas[j].second) == 0) {
        used[i] = used[j] = 1;
        mas[i].first = mas[i].second = INF;
        mas[j].first = mas[j].second = INF;
        r -= 2;
        break;
      }
    }
  }
  sort(mas, mas + n);
  if (r < 1) {
    printf("-1");
    return 0;
  }
  vector<pair<long long, long long> > ans;
  int sz = 0;
  for (int i = 0; i < r; i++) {
    long long x2 = (mas[0].first + mas[i].first);
    long long y2 = (mas[0].second + mas[i].second);
    long double a = Cx * 2 - x2 * n, b = Cy * 2 - y2 * n;
    for (int j = 0; j < r; j++) {
      long long del = -b * mas[j].first + a * mas[j].second;
      temp[j] = del;
    }
    x2 = temp[0] + temp[i];
    sort(temp, temp + r);
    bool ok = 1;
    long double er = 0;
    for (int j = 0; j < r; j++) {
      long long t = x2 - temp[j] - temp[r - 1 - j];
      if (t != 0) {
        ok = 0;
        break;
      }
    }
    if (ok) {
      long long A = 2 * Cx - n * 1LL * (mas[0].first + mas[i].first);
      long long B = 2 * Cy - n * 1LL * (mas[0].second + mas[i].second);
      if (A < 0) {
        A /= -1;
        B /= -1;
      }
      long long d = gcd(A, B);
      ans.push_back(make_pair(A / d, B / d));
    }
  }
  if (ans.empty()) {
    printf("0");
    return 0;
  }
  sort(ans.begin(), ans.end());
  for (int i = 0; i < ((int)ans.size()) - 1; i++) {
    if ((ans[i].first == ans[i + 1].first) &&
        (ans[i].second == ans[i + 1].second)) {
      sz++;
    }
  }
  printf("%d", ans.size() - sz);
  return 0;
}

```