#include <bits/stdc++.h>
using namespace std;
const int N = 2e3 + 10;
int gi() {
  int x = 0, o = 1;
  char ch = getchar();
  while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
  if (ch == '-') o = -1, ch = getchar();
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  return x * o;
}
struct point {
  long long x = 0, y = 0;
  point() {}
  point(long long _x, long long _y) { x = _x, y = _y; }
  point operator+(const point &A) const { return point(x + A.x, y + A.y); }
  point operator-(const point &A) const { return point(x - A.x, y - A.y); }
  long long operator*(const point &A) const { return x * A.x + y * A.y; }
  int operator<(const point &A) const { return x == A.x ? y < A.y : x < A.x; }
  void rotate() {
    swap(x, y);
    y = -y;
  }
} p[N];
struct cmp {
  int operator()(const point &A, const point &B) const {
    return 1ll * A.x * B.y - 1ll * A.y * B.x < 0;
  }
};
int n;
map<point, int> cnt;
vector<point> A, B;
set<point, cmp> ans;
vector<long long> trans(vector<point> A, point l) {
  vector<long long> ret;
  for (auto x : A) ret.push_back(x * l);
  sort(ret.begin(), ret.end());
  return ret;
}
int main() {
  n = gi();
  point sum;
  for (int i = 1; i <= n; i++) {
    p[i].x = gi(), p[i].y = gi();
    sum = sum + p[i];
    p[i].x *= n, p[i].y *= n;
  }
  for (int i = 1; i <= n; i++) {
    ++cnt[p[i]];
    p[i] = sum + sum - p[i];
    --cnt[p[i]];
  }
  for (auto &x : cnt) {
    while (x.second > 0) A.push_back(x.first), --x.second;
    while (x.second < 0) B.push_back(x.first), ++x.second;
  }
  if (A.empty()) return puts("-1"), 0;
  for (auto x : B) {
    point p = x - A[0];
    p.rotate();
    if (p.x < 0) p.x = -p.x, p.y = -p.y;
    if (trans(A, p) == trans(B, p)) ans.insert(p);
  }
  cout << ans.size();
  return 0;
}

### Prompt

Please formulate 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;
int gi() {
  int x = 0, o = 1;
  char ch = getchar();
  while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
  if (ch == '-') o = -1, ch = getchar();
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  return x * o;
}
struct point {
  long long x = 0, y = 0;
  point() {}
  point(long long _x, long long _y) { x = _x, y = _y; }
  point operator+(const point &A) const { return point(x + A.x, y + A.y); }
  point operator-(const point &A) const { return point(x - A.x, y - A.y); }
  long long operator*(const point &A) const { return x * A.x + y * A.y; }
  int operator<(const point &A) const { return x == A.x ? y < A.y : x < A.x; }
  void rotate() {
    swap(x, y);
    y = -y;
  }
} p[N];
struct cmp {
  int operator()(const point &A, const point &B) const {
    return 1ll * A.x * B.y - 1ll * A.y * B.x < 0;
  }
};
int n;
map<point, int> cnt;
vector<point> A, B;
set<point, cmp> ans;
vector<long long> trans(vector<point> A, point l) {
  vector<long long> ret;
  for (auto x : A) ret.push_back(x * l);
  sort(ret.begin(), ret.end());
  return ret;
}
int main() {
  n = gi();
  point sum;
  for (int i = 1; i <= n; i++) {
    p[i].x = gi(), p[i].y = gi();
    sum = sum + p[i];
    p[i].x *= n, p[i].y *= n;
  }
  for (int i = 1; i <= n; i++) {
    ++cnt[p[i]];
    p[i] = sum + sum - p[i];
    --cnt[p[i]];
  }
  for (auto &x : cnt) {
    while (x.second > 0) A.push_back(x.first), --x.second;
    while (x.second < 0) B.push_back(x.first), ++x.second;
  }
  if (A.empty()) return puts("-1"), 0;
  for (auto x : B) {
    point p = x - A[0];
    p.rotate();
    if (p.x < 0) p.x = -p.x, p.y = -p.y;
    if (trans(A, p) == trans(B, p)) ans.insert(p);
  }
  cout << ans.size();
  return 0;
}

```