#include <bits/stdc++.h>
using namespace std;
const long double pi = acos(-1);
const int oo = 1 << 30;
const long long OO = 1e18;
const int N = 2010;
int gi() {
  int w = 0;
  bool q = 1;
  char c = getchar();
  while ((c < '0' || c > '9') && c != '-') c = getchar();
  if (c == '-') q = 0, c = getchar();
  while (c >= '0' && c <= '9') w = w * 10 + c - '0', c = getchar();
  return q ? w : -w;
}
struct P {
  long long x, y;
  inline bool operator<(const P &b) const {
    return x == b.x ? y < b.y : x < b.x;
  }
} p[N], a[N], b[N];
inline P operator+(const P &a, const P &b) { return (P){a.x + b.x, a.y + b.y}; }
inline P operator-(const P &a, const P &b) { return (P){a.x - b.x, a.y - b.y}; }
inline long long operator*(const P &a, const P &b) {
  return a.x * b.x + a.y * b.y;
}
struct cmp {
  inline bool operator()(const P &a, const P &b) const {
    return a.x * b.y < a.y * b.x;
  }
};
inline vector<long long> trans(P *a, int n, P c) {
  vector<long long> v;
  for (int i = 0; i < n; i++) v.push_back(a[i] * c);
  sort(v.begin(), v.end());
  return v;
}
int main() {
  int n = gi(), i, m;
  P sum = (P){0, 0}, c;
  map<P, int> tot;
  set<P, cmp> ans;
  for (i = 0; i < n; i++) {
    p[i].x = gi(), p[i].y = gi();
    sum = sum + p[i];
    p[i].x *= n, p[i].y *= n;
  }
  for (i = 0; i < n; i++) {
    tot[p[i]]++;
    p[i].x = sum.x * 2 - p[i].x;
    p[i].y = sum.y * 2 - p[i].y;
    tot[p[i]]--;
  }
  n = m = 0;
  for (auto &t : tot) {
    while (t.second > 0) a[n++] = t.first, t.second--;
    while (t.second < 0) b[m++] = t.first, t.second++;
  }
  if (!n) return puts("-1"), 0;
  for (i = 0; i < m; i++) {
    c = b[i] - a[0];
    swap(c.x, c.y);
    c.x *= -1;
    if (c.x < 0) c.x *= -1, c.y *= -1;
    if (trans(a, n, c) == trans(b, m, c)) ans.insert(c);
  }
  printf("%d\n", ans.size());
  return 0;
}

### Prompt

Develop a solution in cpp to the problem described below:

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 long double pi = acos(-1);
const int oo = 1 << 30;
const long long OO = 1e18;
const int N = 2010;
int gi() {
  int w = 0;
  bool q = 1;
  char c = getchar();
  while ((c < '0' || c > '9') && c != '-') c = getchar();
  if (c == '-') q = 0, c = getchar();
  while (c >= '0' && c <= '9') w = w * 10 + c - '0', c = getchar();
  return q ? w : -w;
}
struct P {
  long long x, y;
  inline bool operator<(const P &b) const {
    return x == b.x ? y < b.y : x < b.x;
  }
} p[N], a[N], b[N];
inline P operator+(const P &a, const P &b) { return (P){a.x + b.x, a.y + b.y}; }
inline P operator-(const P &a, const P &b) { return (P){a.x - b.x, a.y - b.y}; }
inline long long operator*(const P &a, const P &b) {
  return a.x * b.x + a.y * b.y;
}
struct cmp {
  inline bool operator()(const P &a, const P &b) const {
    return a.x * b.y < a.y * b.x;
  }
};
inline vector<long long> trans(P *a, int n, P c) {
  vector<long long> v;
  for (int i = 0; i < n; i++) v.push_back(a[i] * c);
  sort(v.begin(), v.end());
  return v;
}
int main() {
  int n = gi(), i, m;
  P sum = (P){0, 0}, c;
  map<P, int> tot;
  set<P, cmp> ans;
  for (i = 0; i < n; i++) {
    p[i].x = gi(), p[i].y = gi();
    sum = sum + p[i];
    p[i].x *= n, p[i].y *= n;
  }
  for (i = 0; i < n; i++) {
    tot[p[i]]++;
    p[i].x = sum.x * 2 - p[i].x;
    p[i].y = sum.y * 2 - p[i].y;
    tot[p[i]]--;
  }
  n = m = 0;
  for (auto &t : tot) {
    while (t.second > 0) a[n++] = t.first, t.second--;
    while (t.second < 0) b[m++] = t.first, t.second++;
  }
  if (!n) return puts("-1"), 0;
  for (i = 0; i < m; i++) {
    c = b[i] - a[0];
    swap(c.x, c.y);
    c.x *= -1;
    if (c.x < 0) c.x *= -1, c.y *= -1;
    if (trans(a, n, c) == trans(b, m, c)) ans.insert(c);
  }
  printf("%d\n", ans.size());
  return 0;
}

```