#include <bits/stdc++.h>
using namespace std;
const int N = 2020;
int n;
long long int x[N], y[N], px, py;
set<pair<long, long> > points;
long long int gcd(long long int a, long long int b) {
  return a ? gcd(b % a, a) : b;
}
void normal(pair<long, long> &n) {
  int d = gcd(n.first, n.second);
  n.first /= d;
  n.second /= d;
  if (n.first < 0) {
    n.first = -n.first;
    n.second = -n.second;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < (int)(n); i++) {
    cin >> x[i] >> y[i];
    px += x[i];
    py += y[i];
    x[i] *= n;
    y[i] *= n;
    points.emplace(x[i], y[i]);
  }
  for (int i = 0; i < (int)(n); i++) {
    auto sx = 2 * px - x[i];
    auto sy = 2 * py - y[i];
    auto p = make_pair(x[i], y[i]);
    auto s = make_pair(sx, sy);
    if (points.count(s)) {
      points.erase(s);
      if (points.count(p)) points.erase(p);
    }
  }
  n = 0;
  for (auto &xy : points) {
    x[n] = xy.first;
    y[n] = xy.second;
    n++;
  }
  if (n < 2) {
    cout << -1 << endl;
    return 0;
  }
  set<pair<long, long> > ans;
  for (int i = 0; i < (int)(n); i++) {
    pair<long, long> q = make_pair(x[0] + x[i], y[0] + y[i]);
    pair<long, long> p = make_pair(2 * px, 2 * py);
    pair<long, long> v = make_pair(q.first - p.first, q.second - p.second);
    pair<long, long> norm = make_pair(-v.second, v.first);
    normal(norm);
    vector<long long int> d;
    for (int i = 0; i < (int)(n); i++)
      d.emplace_back(norm.first * x[i] + norm.second * y[i]);
    sort((d).begin(), (d).end());
    auto goal = d.front() + d.back();
    int sz = ((int)(d).size()), ok = 1;
    for (int i = 0, j = sz - 1; i < j; i++, j--) {
      ok &= d[i] + d[j] == goal;
    }
    if (ok) ans.insert(norm);
  }
  cout << ((int)(ans).size()) << endl;
  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 int N = 2020;
int n;
long long int x[N], y[N], px, py;
set<pair<long, long> > points;
long long int gcd(long long int a, long long int b) {
  return a ? gcd(b % a, a) : b;
}
void normal(pair<long, long> &n) {
  int d = gcd(n.first, n.second);
  n.first /= d;
  n.second /= d;
  if (n.first < 0) {
    n.first = -n.first;
    n.second = -n.second;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < (int)(n); i++) {
    cin >> x[i] >> y[i];
    px += x[i];
    py += y[i];
    x[i] *= n;
    y[i] *= n;
    points.emplace(x[i], y[i]);
  }
  for (int i = 0; i < (int)(n); i++) {
    auto sx = 2 * px - x[i];
    auto sy = 2 * py - y[i];
    auto p = make_pair(x[i], y[i]);
    auto s = make_pair(sx, sy);
    if (points.count(s)) {
      points.erase(s);
      if (points.count(p)) points.erase(p);
    }
  }
  n = 0;
  for (auto &xy : points) {
    x[n] = xy.first;
    y[n] = xy.second;
    n++;
  }
  if (n < 2) {
    cout << -1 << endl;
    return 0;
  }
  set<pair<long, long> > ans;
  for (int i = 0; i < (int)(n); i++) {
    pair<long, long> q = make_pair(x[0] + x[i], y[0] + y[i]);
    pair<long, long> p = make_pair(2 * px, 2 * py);
    pair<long, long> v = make_pair(q.first - p.first, q.second - p.second);
    pair<long, long> norm = make_pair(-v.second, v.first);
    normal(norm);
    vector<long long int> d;
    for (int i = 0; i < (int)(n); i++)
      d.emplace_back(norm.first * x[i] + norm.second * y[i]);
    sort((d).begin(), (d).end());
    auto goal = d.front() + d.back();
    int sz = ((int)(d).size()), ok = 1;
    for (int i = 0, j = sz - 1; i < j; i++, j--) {
      ok &= d[i] + d[j] == goal;
    }
    if (ok) ans.insert(norm);
  }
  cout << ((int)(ans).size()) << endl;
  return 0;
}

```