#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2005;
int N;
int x[MAXN], y[MAXN];
map<pair<long long, long long>, int> cnt;
vector<pair<long long, long long> > a, b;
struct cmp {
  bool operator()(const pair<long long, long long> &lhs,
                  const pair<long long, long long> &rhs) const {
    return lhs.first * rhs.second < rhs.first * lhs.second;
  }
};
set<pair<long long, long long>, cmp> good;
void load() {
  scanf("%d", &N);
  for (int i = 0; i < N; i++) scanf("%d%d", x + i, y + i);
}
vector<long long> get(vector<pair<long long, long long> > v, long long rx,
                      long long ry) {
  vector<long long> res;
  for (auto it : v) res.push_back(it.first * rx + it.second * ry);
  sort(res.begin(), res.end());
  return res;
}
void check(long long rx, long long ry) {
  if (get(a, rx, ry) == get(b, rx, ry)) {
    if (rx < 0) {
      rx = -rx;
      ry = -ry;
    }
    good.insert({rx, ry});
  }
}
int solve() {
  int sx = 0, sy = 0;
  for (int i = 0; i < N; i++) {
    sx += x[i];
    sy += y[i];
    x[i] *= N;
    y[i] *= N;
  }
  for (int i = 0; i < N; i++) {
    cnt[{x[i], y[i]}]++;
    cnt[{2ll * sx - x[i], 2ll * sy - y[i]}]--;
  }
  for (auto it : cnt)
    for (int i = 0; i < abs(it.second); i++)
      if (it.second > 0)
        a.push_back(it.first);
      else
        b.push_back(it.first);
  assert(a.size() == b.size());
  if (a.empty()) return -1;
  for (auto it : b) check(it.second - a[0].second, a[0].first - it.first);
  return good.size();
}
int main() {
  load();
  printf("%d\n", solve());
  return 0;
}

### Prompt

In cpp, your task is to solve 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 MAXN = 2005;
int N;
int x[MAXN], y[MAXN];
map<pair<long long, long long>, int> cnt;
vector<pair<long long, long long> > a, b;
struct cmp {
  bool operator()(const pair<long long, long long> &lhs,
                  const pair<long long, long long> &rhs) const {
    return lhs.first * rhs.second < rhs.first * lhs.second;
  }
};
set<pair<long long, long long>, cmp> good;
void load() {
  scanf("%d", &N);
  for (int i = 0; i < N; i++) scanf("%d%d", x + i, y + i);
}
vector<long long> get(vector<pair<long long, long long> > v, long long rx,
                      long long ry) {
  vector<long long> res;
  for (auto it : v) res.push_back(it.first * rx + it.second * ry);
  sort(res.begin(), res.end());
  return res;
}
void check(long long rx, long long ry) {
  if (get(a, rx, ry) == get(b, rx, ry)) {
    if (rx < 0) {
      rx = -rx;
      ry = -ry;
    }
    good.insert({rx, ry});
  }
}
int solve() {
  int sx = 0, sy = 0;
  for (int i = 0; i < N; i++) {
    sx += x[i];
    sy += y[i];
    x[i] *= N;
    y[i] *= N;
  }
  for (int i = 0; i < N; i++) {
    cnt[{x[i], y[i]}]++;
    cnt[{2ll * sx - x[i], 2ll * sy - y[i]}]--;
  }
  for (auto it : cnt)
    for (int i = 0; i < abs(it.second); i++)
      if (it.second > 0)
        a.push_back(it.first);
      else
        b.push_back(it.first);
  assert(a.size() == b.size());
  if (a.empty()) return -1;
  for (auto it : b) check(it.second - a[0].second, a[0].first - it.first);
  return good.size();
}
int main() {
  load();
  printf("%d\n", solve());
  return 0;
}

```