#include <bits/stdc++.h>
#pragma GCC optimize("Ofast", "inline", "-ffast-math")
using namespace std;
const int N = 2005;
const double eps = 1e-8;
const double inf = 1e100;
struct Vec {
  double x, y;
  Vec(double _x = 0, double _y = 0) : x(_x), y(_y) {}
  Vec operator+(const Vec &b) const { return Vec(x + b.x, y + b.y); }
  Vec operator-(const Vec &b) const { return Vec(x - b.x, y - b.y); }
  Vec operator*(const double &b) const { return Vec(x * b, y * b); }
  Vec operator/(const double &b) const { return Vec(x / b, y / b); }
  double length() { return sqrt(x * x + y * y); }
  Vec unit() { return *this / length(); }
} C, a[N], b[N];
int n, m, ans, flag[N];
double K[N * N];
bool equ(Vec a, Vec b) { return (abs(a.x - b.x) + abs(a.y - b.y) < eps); }
int init() {
  ans = m = 0;
  C = Vec(0, 0);
  memset(flag, 0, sizeof flag);
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%lf%lf", &a[i].x, &a[i].y);
    C = C + a[i];
  }
  C = C / n;
  for (int i = 1; i <= n; ++i) {
    for (int j = i + 1; j <= n; ++j) {
      if (equ(C * 2, a[i] + a[j])) {
        flag[i] = flag[j] = 1;
      }
    }
  }
  for (int i = 1; i <= n; ++i) {
    if (!flag[i]) {
      b[++m] = a[i];
    }
  }
  if (m == 0) return puts("-1"), 1;
  if (m == 1) {
    if (equ(C, b[1]))
      return puts("-1"), 1;
    else
      return puts("0"), 1;
  }
  n = m;
  return 0;
}
double calc(double k, Vec b) { return (k * b.y + b.x) / (1 + k * k); }
void check(double k) {
  double sum = 0, X = calc(k, C);
  static double x[N];
  for (int i = 1; i <= n; ++i) {
    x[i] = calc(k, b[i]) - X;
  }
  sort(x + 1, x + n + 1);
  for (int i = 1; i * 2 <= n + 1; ++i) {
    if (abs(x[i] + x[n - i + 1]) > eps) return;
  }
  ++ans;
}
void check_inf() {
  static double x[N];
  for (int i = 1; i <= n; ++i) {
    x[i] = b[i].y - C.y;
  }
  sort(x + 1, x + n + 1);
  for (int i = 1; i * 2 <= n + 1; ++i) {
    if (abs(x[i] + x[n - i + 1]) > eps) return;
  }
  ++ans;
}
void Solve() {
  if (init()) return;
  int cnt = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = i + 1; j <= n; ++j) {
      if (abs((b[i].y + b[j].y - 2 * C.y)) > eps)
        K[++cnt] = (2 * C.x - b[i].x - b[j].x) / (b[i].y + b[j].y - 2 * C.y);
    }
  }
  check_inf();
  sort(K + 1, K + cnt + 1);
  K[cnt + 1] = inf;
  double pre = K[1];
  for (int i = 2, num = 1; i <= cnt + 1; ++i) {
    if (abs(K[i] - pre) < eps)
      ++num;
    else {
      if (num * 2 + 1 >= n) {
        check(pre);
      }
      num = 1, pre = K[i];
    }
  }
  printf("%d\n", ans);
}
int main() {
  Solve();
  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>
#pragma GCC optimize("Ofast", "inline", "-ffast-math")
using namespace std;
const int N = 2005;
const double eps = 1e-8;
const double inf = 1e100;
struct Vec {
  double x, y;
  Vec(double _x = 0, double _y = 0) : x(_x), y(_y) {}
  Vec operator+(const Vec &b) const { return Vec(x + b.x, y + b.y); }
  Vec operator-(const Vec &b) const { return Vec(x - b.x, y - b.y); }
  Vec operator*(const double &b) const { return Vec(x * b, y * b); }
  Vec operator/(const double &b) const { return Vec(x / b, y / b); }
  double length() { return sqrt(x * x + y * y); }
  Vec unit() { return *this / length(); }
} C, a[N], b[N];
int n, m, ans, flag[N];
double K[N * N];
bool equ(Vec a, Vec b) { return (abs(a.x - b.x) + abs(a.y - b.y) < eps); }
int init() {
  ans = m = 0;
  C = Vec(0, 0);
  memset(flag, 0, sizeof flag);
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%lf%lf", &a[i].x, &a[i].y);
    C = C + a[i];
  }
  C = C / n;
  for (int i = 1; i <= n; ++i) {
    for (int j = i + 1; j <= n; ++j) {
      if (equ(C * 2, a[i] + a[j])) {
        flag[i] = flag[j] = 1;
      }
    }
  }
  for (int i = 1; i <= n; ++i) {
    if (!flag[i]) {
      b[++m] = a[i];
    }
  }
  if (m == 0) return puts("-1"), 1;
  if (m == 1) {
    if (equ(C, b[1]))
      return puts("-1"), 1;
    else
      return puts("0"), 1;
  }
  n = m;
  return 0;
}
double calc(double k, Vec b) { return (k * b.y + b.x) / (1 + k * k); }
void check(double k) {
  double sum = 0, X = calc(k, C);
  static double x[N];
  for (int i = 1; i <= n; ++i) {
    x[i] = calc(k, b[i]) - X;
  }
  sort(x + 1, x + n + 1);
  for (int i = 1; i * 2 <= n + 1; ++i) {
    if (abs(x[i] + x[n - i + 1]) > eps) return;
  }
  ++ans;
}
void check_inf() {
  static double x[N];
  for (int i = 1; i <= n; ++i) {
    x[i] = b[i].y - C.y;
  }
  sort(x + 1, x + n + 1);
  for (int i = 1; i * 2 <= n + 1; ++i) {
    if (abs(x[i] + x[n - i + 1]) > eps) return;
  }
  ++ans;
}
void Solve() {
  if (init()) return;
  int cnt = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = i + 1; j <= n; ++j) {
      if (abs((b[i].y + b[j].y - 2 * C.y)) > eps)
        K[++cnt] = (2 * C.x - b[i].x - b[j].x) / (b[i].y + b[j].y - 2 * C.y);
    }
  }
  check_inf();
  sort(K + 1, K + cnt + 1);
  K[cnt + 1] = inf;
  double pre = K[1];
  for (int i = 2, num = 1; i <= cnt + 1; ++i) {
    if (abs(K[i] - pre) < eps)
      ++num;
    else {
      if (num * 2 + 1 >= n) {
        check(pre);
      }
      num = 1, pre = K[i];
    }
  }
  printf("%d\n", ans);
}
int main() {
  Solve();
  return 0;
}

```