#include <bits/stdc++.h>
using namespace std;
const int MN = 2010;
int N;
pair<int, int> P[MN];
pair<double, double> C;
vector<pair<int, int> > tmp;
int chk[MN];
struct Line {
  double a, b, c;
  double f(double x, double y) { return a * x + b * y + c; }
};
Line getLine(pair<double, double> p, pair<double, double> q) {
  return {(q.second - p.second), (p.first - q.first),
          (q.first - p.first) * p.second - (q.second - p.second) * p.first};
}
vector<double> slope;
int main() {
  scanf("%d", &N);
  double xsum = 0;
  double ysum = 0;
  for (int i = 0; i < N; i++) {
    scanf("%d %d", &P[i].first, &P[i].second);
    xsum += P[i].first;
    ysum += P[i].second;
  }
  C = {xsum / N, ysum / N};
  for (int i = 0; i < N; i++) {
    for (int j = i; j < N; j++) {
      if (abs(2 * C.first - P[i].first - P[j].first) < 1e-9 &&
          abs(2 * C.second - P[i].second - P[j].second) < 1e-9) {
        chk[i] = 1;
        chk[j] = 1;
        break;
      }
    }
  }
  for (int i = 0; i < N; i++)
    if (!chk[i]) tmp.push_back(P[i]);
  N = tmp.size();
  for (int i = 0; i < N; i++) P[i] = tmp[i];
  if (!N) {
    printf("-1");
    return 0;
  }
  for (int i = (N % 2 ? 0 : 1); i < N; i++) {
    pair<double, double> M = {(double)(P[0].first + P[i].first) / 2,
                              (double)(P[0].second + P[i].second) / 2};
    Line line = getLine(C, M);
    vector<double> tmp;
    for (int j = 0; j < N; j++) {
      tmp.push_back(line.f(P[j].first, P[j].second));
    }
    sort(tmp.begin(), tmp.end());
    bool ok = true;
    for (int j = 0; j < N; j++)
      if (abs(tmp[j] + tmp[N - 1 - j]) > 1e-9) {
        ok = false;
        break;
      }
    if (ok) {
      if (line.a == 0)
        slope.push_back(1e9);
      else
        slope.push_back(line.b / line.a);
    }
  }
  sort(slope.begin(), slope.end());
  int ans = 0;
  for (int i = 0; i < slope.size(); i++) {
    if (i == 0 || abs(slope[i] - slope[i - 1]) > 1e-9) ans++;
  }
  printf("%d", ans);
}

### Prompt

Construct a cpp code solution to the problem outlined:

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 MN = 2010;
int N;
pair<int, int> P[MN];
pair<double, double> C;
vector<pair<int, int> > tmp;
int chk[MN];
struct Line {
  double a, b, c;
  double f(double x, double y) { return a * x + b * y + c; }
};
Line getLine(pair<double, double> p, pair<double, double> q) {
  return {(q.second - p.second), (p.first - q.first),
          (q.first - p.first) * p.second - (q.second - p.second) * p.first};
}
vector<double> slope;
int main() {
  scanf("%d", &N);
  double xsum = 0;
  double ysum = 0;
  for (int i = 0; i < N; i++) {
    scanf("%d %d", &P[i].first, &P[i].second);
    xsum += P[i].first;
    ysum += P[i].second;
  }
  C = {xsum / N, ysum / N};
  for (int i = 0; i < N; i++) {
    for (int j = i; j < N; j++) {
      if (abs(2 * C.first - P[i].first - P[j].first) < 1e-9 &&
          abs(2 * C.second - P[i].second - P[j].second) < 1e-9) {
        chk[i] = 1;
        chk[j] = 1;
        break;
      }
    }
  }
  for (int i = 0; i < N; i++)
    if (!chk[i]) tmp.push_back(P[i]);
  N = tmp.size();
  for (int i = 0; i < N; i++) P[i] = tmp[i];
  if (!N) {
    printf("-1");
    return 0;
  }
  for (int i = (N % 2 ? 0 : 1); i < N; i++) {
    pair<double, double> M = {(double)(P[0].first + P[i].first) / 2,
                              (double)(P[0].second + P[i].second) / 2};
    Line line = getLine(C, M);
    vector<double> tmp;
    for (int j = 0; j < N; j++) {
      tmp.push_back(line.f(P[j].first, P[j].second));
    }
    sort(tmp.begin(), tmp.end());
    bool ok = true;
    for (int j = 0; j < N; j++)
      if (abs(tmp[j] + tmp[N - 1 - j]) > 1e-9) {
        ok = false;
        break;
      }
    if (ok) {
      if (line.a == 0)
        slope.push_back(1e9);
      else
        slope.push_back(line.b / line.a);
    }
  }
  sort(slope.begin(), slope.end());
  int ans = 0;
  for (int i = 0; i < slope.size(); i++) {
    if (i == 0 || abs(slope[i] - slope[i - 1]) > 1e-9) ans++;
  }
  printf("%d", ans);
}

```