#include <bits/stdc++.h>
using namespace std;
const int oo = 0x3f3f3f3f;
const long long ooo = 9223372036854775807ll;
const int _cnt = 1000 * 1000 + 7;
const int _p = 1000 * 1000 * 1000 + 7;
const int N = 1000105;
const double PI = acos(-1.0);
const double eps = 1e-6;
int o(int x) { return x % _p; }
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
void file_put() {
  freopen("filename.in", "r", stdin);
  freopen("filename.out", "w", stdout);
}
struct ttype {
  long long x, y;
  friend bool operator<(const ttype &a, const ttype &b) {
    return a.x < b.x || a.x == b.x && a.y < b.y;
  }
  friend ttype operator-(const ttype &a, const ttype &b) {
    return ttype{a.x - b.x, a.y - b.y};
  }
};
int n;
long long sx = 0, sy = 0, dx, dy;
ttype D[N];
map<ttype, int> M;
set<ttype> ans;
vector<ttype> A[2];
vector<long long> V[2];
void check(ttype t) {
  V[0].clear(), V[1].clear();
  for (int i = (0); i <= (1); ++i)
    for (auto p : A[i]) V[i].push_back(p.x * t.y - p.y * t.x);
  for (int i = (0); i <= (1); ++i) sort((V[i]).begin(), (V[i]).end());
  if (V[0] != V[1]) return;
  if (t.x < 0) t.x = -t.x, t.y = -t.y;
  long long d = gcd(t.x, abs(t.y));
  ans.insert(ttype{t.x / d, t.y / d});
}
int main() {
  scanf("%d", &n);
  for (int i = (1); i <= (n); ++i) scanf("%I64d%I64d", &D[i].x, &D[i].y);
  for (int i = (1); i <= (n); ++i) sx += D[i].x, sy += D[i].y;
  for (int i = (1); i <= (n); ++i) D[i].x *= n, D[i].y *= n;
  for (int i = (1); i <= (n); ++i)
    M[D[i]]++, M[ttype{2 * sx - D[i].x, 2 * sy - D[i].y}]--;
  for (__typeof((M).begin()) it = (M).begin(); it != (M).end(); it++)
    for (int i = (1); i <= (abs(it->second)); ++i)
      A[it->second > 0].push_back(it->first);
  if (A[0].size() == 0) return 0 * printf("-1\n");
  for (__typeof((A[0]).begin()) it = (A[0]).begin(); it != (A[0]).end(); it++)
    check(A[1][0] - *it);
  printf("%d\n", ans.size());
  return 0;
}

### Prompt

Construct a CPP code solution to the problem outlined:

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 oo = 0x3f3f3f3f;
const long long ooo = 9223372036854775807ll;
const int _cnt = 1000 * 1000 + 7;
const int _p = 1000 * 1000 * 1000 + 7;
const int N = 1000105;
const double PI = acos(-1.0);
const double eps = 1e-6;
int o(int x) { return x % _p; }
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
void file_put() {
  freopen("filename.in", "r", stdin);
  freopen("filename.out", "w", stdout);
}
struct ttype {
  long long x, y;
  friend bool operator<(const ttype &a, const ttype &b) {
    return a.x < b.x || a.x == b.x && a.y < b.y;
  }
  friend ttype operator-(const ttype &a, const ttype &b) {
    return ttype{a.x - b.x, a.y - b.y};
  }
};
int n;
long long sx = 0, sy = 0, dx, dy;
ttype D[N];
map<ttype, int> M;
set<ttype> ans;
vector<ttype> A[2];
vector<long long> V[2];
void check(ttype t) {
  V[0].clear(), V[1].clear();
  for (int i = (0); i <= (1); ++i)
    for (auto p : A[i]) V[i].push_back(p.x * t.y - p.y * t.x);
  for (int i = (0); i <= (1); ++i) sort((V[i]).begin(), (V[i]).end());
  if (V[0] != V[1]) return;
  if (t.x < 0) t.x = -t.x, t.y = -t.y;
  long long d = gcd(t.x, abs(t.y));
  ans.insert(ttype{t.x / d, t.y / d});
}
int main() {
  scanf("%d", &n);
  for (int i = (1); i <= (n); ++i) scanf("%I64d%I64d", &D[i].x, &D[i].y);
  for (int i = (1); i <= (n); ++i) sx += D[i].x, sy += D[i].y;
  for (int i = (1); i <= (n); ++i) D[i].x *= n, D[i].y *= n;
  for (int i = (1); i <= (n); ++i)
    M[D[i]]++, M[ttype{2 * sx - D[i].x, 2 * sy - D[i].y}]--;
  for (__typeof((M).begin()) it = (M).begin(); it != (M).end(); it++)
    for (int i = (1); i <= (abs(it->second)); ++i)
      A[it->second > 0].push_back(it->first);
  if (A[0].size() == 0) return 0 * printf("-1\n");
  for (__typeof((A[0]).begin()) it = (A[0]).begin(); it != (A[0]).end(); it++)
    check(A[1][0] - *it);
  printf("%d\n", ans.size());
  return 0;
}

```