#include <bits/stdc++.h>
using namespace std;
const int mx = 2e3 + 10;
long long int x[mx], y[mx];
bool good[mx];
pair<long long int, long long int> operator+(
    pair<long long int, long long int> a,
    pair<long long int, long long int> b) {
  return {a.first + b.first, a.second + b.second};
}
long long int operator*(pair<long long int, long long int> a,
                        pair<long long int, long long int> b) {
  return a.first * b.second - b.first * a.second;
}
long long int gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  int n;
  cin >> n;
  long long int sx = 0, sy = 0;
  for (int i = 0; i < n; i++) {
    cin >> x[i] >> y[i];
    sx += x[i], sy += y[i];
    x[i] *= n;
    y[i] *= n;
  }
  for (int i = 0; i < n; i++) {
    x[i] -= sx;
    y[i] -= sy;
    good[i] = true;
  }
  for (int i = 0; i < n; i++) {
    int at = -1;
    for (int j = 0; j < n; j++)
      if (j != i && x[j] == -x[i] && y[j] == -y[i] && good[j]) at = j;
    if (at != -1) good[i] = good[at] = false;
  }
  vector<pair<long long int, long long int> > p;
  for (int i = 0; i < n; i++)
    if (good[i]) p.push_back({x[i], y[i]});
  n = p.size();
  if (n <= 1) {
    puts("-1");
    return 0;
  }
  pair<long long int, long long int> a = p[0];
  set<pair<long long int, long long int> > all;
  for (int i = 0; i < n; i++) {
    pair<long long int, long long int> b = p[i];
    pair<long long int, long long int> u = a + b;
    if (u.first == 0 && u.second == 0) continue;
    vector<pair<long long int, int> > cross;
    for (int j = 0; j < n; j++) {
      long long int c = u * p[j];
      long long int sgn = 1;
      if (c == 0)
        sgn = 0;
      else if (c > 0)
        sgn = 1;
      else
        sgn = -1;
      cross.push_back({c * sgn, sgn});
    }
    sort(cross.begin(), cross.end());
    bool ok = true;
    for (int j = 0; j < n;) {
      long long int v = cross[j].first;
      int cnt = 0;
      while (j < n && cross[j].first == v) cnt += cross[j++].second;
      ok &= (cnt == 0);
    }
    if (ok) {
      long long int dx = u.first, dy = u.second;
      long long int g = gcd(dx, dy);
      dx /= g, dy /= g;
      if (dx < 0) dx = -dx, dy = -dy;
      if (dy < 0) dx = -dx, dy = -dy;
      all.insert({dx, dy});
    }
  }
  cout << all.size() << endl;
  return 0;
}

### Prompt

Please create a solution in CPP 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 mx = 2e3 + 10;
long long int x[mx], y[mx];
bool good[mx];
pair<long long int, long long int> operator+(
    pair<long long int, long long int> a,
    pair<long long int, long long int> b) {
  return {a.first + b.first, a.second + b.second};
}
long long int operator*(pair<long long int, long long int> a,
                        pair<long long int, long long int> b) {
  return a.first * b.second - b.first * a.second;
}
long long int gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  int n;
  cin >> n;
  long long int sx = 0, sy = 0;
  for (int i = 0; i < n; i++) {
    cin >> x[i] >> y[i];
    sx += x[i], sy += y[i];
    x[i] *= n;
    y[i] *= n;
  }
  for (int i = 0; i < n; i++) {
    x[i] -= sx;
    y[i] -= sy;
    good[i] = true;
  }
  for (int i = 0; i < n; i++) {
    int at = -1;
    for (int j = 0; j < n; j++)
      if (j != i && x[j] == -x[i] && y[j] == -y[i] && good[j]) at = j;
    if (at != -1) good[i] = good[at] = false;
  }
  vector<pair<long long int, long long int> > p;
  for (int i = 0; i < n; i++)
    if (good[i]) p.push_back({x[i], y[i]});
  n = p.size();
  if (n <= 1) {
    puts("-1");
    return 0;
  }
  pair<long long int, long long int> a = p[0];
  set<pair<long long int, long long int> > all;
  for (int i = 0; i < n; i++) {
    pair<long long int, long long int> b = p[i];
    pair<long long int, long long int> u = a + b;
    if (u.first == 0 && u.second == 0) continue;
    vector<pair<long long int, int> > cross;
    for (int j = 0; j < n; j++) {
      long long int c = u * p[j];
      long long int sgn = 1;
      if (c == 0)
        sgn = 0;
      else if (c > 0)
        sgn = 1;
      else
        sgn = -1;
      cross.push_back({c * sgn, sgn});
    }
    sort(cross.begin(), cross.end());
    bool ok = true;
    for (int j = 0; j < n;) {
      long long int v = cross[j].first;
      int cnt = 0;
      while (j < n && cross[j].first == v) cnt += cross[j++].second;
      ok &= (cnt == 0);
    }
    if (ok) {
      long long int dx = u.first, dy = u.second;
      long long int g = gcd(dx, dy);
      dx /= g, dy /= g;
      if (dx < 0) dx = -dx, dy = -dy;
      if (dy < 0) dx = -dx, dy = -dy;
      all.insert({dx, dy});
    }
  }
  cout << all.size() << endl;
  return 0;
}

```