#include <bits/stdc++.h>
using namespace std;
const int N = 2010;
const double eps = 1e-8, pi = acos(-1);
inline int judge(double x) { return x > -eps ? x > eps ? 1 : 0 : -1; }
struct point {
  double x, y;
  point(double x_ = 0, double y_ = 0) : 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); }
};
double cross(const point& a, const point& b) { return a.x * b.y - a.y * b.x; }
double dot(const point& a, const point& b) { return a.x * b.x + a.y * b.y; }
int n, cnt, ans, tag[N], num;
point po[N], mi;
double v[N * N], tmp[N];
double calc(point a, point b, point c) {
  point d = point(a.y + c.y - 2 * b.y, a.x + c.x - 2 * b.x);
  if (judge(d.y) < 0) d.x = -d.x, d.y = -d.y;
  if (judge(d.y) == 0) d.x = fabs(d.x);
  return atan2(d.y, d.x);
}
bool check(double x) {
  double co = cos(x), si = sin(x), m;
  for (int i = 1; i <= n; ++i) tmp[i] = po[i].x * co - po[i].y * si;
  m = mi.x * co - mi.y * si;
  sort(tmp + 1, tmp + n + 1);
  for (int i = 1, j = n; i <= j; ++i, --j) {
    if (judge(tmp[i] + tmp[j] - 2 * m)) return 0;
  }
  return 1;
}
int main() {
  scanf("%d", &n);
  mi = point();
  for (int i = 1; i <= n; ++i)
    scanf("%lf%lf", &po[i].x, &po[i].y), mi = mi + po[i];
  mi.x /= n;
  mi.y /= n;
  for (int i = 1; i <= n; ++i) {
    for (int j = i + 1; j <= n; ++j) {
      point d = po[i] + po[j] - point(mi.x * 2, mi.y * 2);
      if ((!judge(d.x)) && (!judge(d.y))) tag[i] = tag[j] = 1;
    }
  }
  int key = 1;
  for (int i = 1; i <= n; ++i)
    if (!tag[i]) ++num, key = 0;
  if (key || n <= 2) return puts("-1"), 0;
  for (int i = 1; i <= n; ++i)
    if (!tag[i])
      for (int j = i + 1; j <= n; ++j)
        if (!tag[j]) v[++cnt] = calc(po[i], mi, po[j]);
  sort(v + 1, v + cnt + 1);
  v[cnt + 1] = 1.0 / 0.0;
  for (int i = 2, j = 1; i <= cnt + 1; ++i) {
    if (judge(v[i] - v[i - 1])) {
      if (i - j >= (num - 1) / 2) ans += check(v[i - 1]);
      j = i;
    }
  }
  printf("%d\n", ans);
  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 N = 2010;
const double eps = 1e-8, pi = acos(-1);
inline int judge(double x) { return x > -eps ? x > eps ? 1 : 0 : -1; }
struct point {
  double x, y;
  point(double x_ = 0, double y_ = 0) : 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); }
};
double cross(const point& a, const point& b) { return a.x * b.y - a.y * b.x; }
double dot(const point& a, const point& b) { return a.x * b.x + a.y * b.y; }
int n, cnt, ans, tag[N], num;
point po[N], mi;
double v[N * N], tmp[N];
double calc(point a, point b, point c) {
  point d = point(a.y + c.y - 2 * b.y, a.x + c.x - 2 * b.x);
  if (judge(d.y) < 0) d.x = -d.x, d.y = -d.y;
  if (judge(d.y) == 0) d.x = fabs(d.x);
  return atan2(d.y, d.x);
}
bool check(double x) {
  double co = cos(x), si = sin(x), m;
  for (int i = 1; i <= n; ++i) tmp[i] = po[i].x * co - po[i].y * si;
  m = mi.x * co - mi.y * si;
  sort(tmp + 1, tmp + n + 1);
  for (int i = 1, j = n; i <= j; ++i, --j) {
    if (judge(tmp[i] + tmp[j] - 2 * m)) return 0;
  }
  return 1;
}
int main() {
  scanf("%d", &n);
  mi = point();
  for (int i = 1; i <= n; ++i)
    scanf("%lf%lf", &po[i].x, &po[i].y), mi = mi + po[i];
  mi.x /= n;
  mi.y /= n;
  for (int i = 1; i <= n; ++i) {
    for (int j = i + 1; j <= n; ++j) {
      point d = po[i] + po[j] - point(mi.x * 2, mi.y * 2);
      if ((!judge(d.x)) && (!judge(d.y))) tag[i] = tag[j] = 1;
    }
  }
  int key = 1;
  for (int i = 1; i <= n; ++i)
    if (!tag[i]) ++num, key = 0;
  if (key || n <= 2) return puts("-1"), 0;
  for (int i = 1; i <= n; ++i)
    if (!tag[i])
      for (int j = i + 1; j <= n; ++j)
        if (!tag[j]) v[++cnt] = calc(po[i], mi, po[j]);
  sort(v + 1, v + cnt + 1);
  v[cnt + 1] = 1.0 / 0.0;
  for (int i = 2, j = 1; i <= cnt + 1; ++i) {
    if (judge(v[i] - v[i - 1])) {
      if (i - j >= (num - 1) / 2) ans += check(v[i - 1]);
      j = i;
    }
  }
  printf("%d\n", ans);
  return 0;
}

```