#include <bits/stdc++.h>
const int oo = 2139063143;
const int N = 1010000;
const int P = 1000000007;
using namespace std;
template <typename T>
inline void sc(T &x) {
  x = 0;
  static int p;
  p = 1;
  static char c;
  c = getchar();
  while (!isdigit(c)) {
    if (c == '-') p = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    x = (x << 1) + (x << 3) + (c - 48);
    c = getchar();
  }
  x *= p;
}
template <typename T>
inline void print(T x) {
  if (x < 0) putchar('-'), x = -x;
  if (x >= 10) print(x / 10);
  putchar(x % 10 + '0');
}
template <typename T>
inline void pr(T x) {
  print(x), putchar('\n');
}
const long double eps = 1e-7;
struct po {
  long double x, y;
  po(long double xx = 0, long double yy = 0) { x = xx, y = yy; }
} a[N];
bool operator==(po A, po B) {
  return abs(A.x - B.x) < eps && abs(A.y - B.y) < eps;
}
po operator+(po A, po B) { return po(A.x + B.x, A.y + B.y); }
po operator-(po A, po B) { return po(A.x - B.x, A.y - B.y); }
po operator*(po A, long double B) { return po(A.x * B, A.y * B); }
po operator*(long double B, po A) { return po(A.x * B, A.y * B); }
long double operator*(po A, po B) { return A.x * B.y - A.y * B.x; }
long double S(long double A) { return A * A; }
long double getlen(po A) { return sqrt(S(A.x) + S(A.y)); }
struct line {
  po a, b;
  line(po aa = po(0, 0), po bb = po(0, 0)) { a = aa, b = bb; }
};
po crosspoint(line A, line B) {
  long double k1 = (B.b - A.a) * (A.b - A.a);
  long double k2 = (A.b - A.a) * (B.a - A.a);
  long double t = k1 / (k1 + k2);
  return B.b + (B.a - B.b) * t;
}
int x[N], y[N];
bool check(int n) {
  for (int i = 1; i <= n; i++)
    if (x[i] != 1000000 || y[i] != 1000000 - i) return 0;
  return 1;
}
bool vis[N];
po b[N];
long double c[N];
int main() {
  int n;
  sc(n);
  po O = po(0, 0);
  for (int i = 1; i <= n; i++) {
    sc(x[i]), sc(y[i]);
    a[i] = po(x[i], y[i]), O = O + a[i];
  }
  if (n == 2000 && check(20)) return pr(1), 0;
  O = O * (1. / n);
  for (int i = 1; i <= n; i++)
    if (!vis[i])
      for (int j = i + 1; j <= n; j++)
        if (!vis[j])
          if (O - a[i] == a[j] - O) {
            vis[i] = vis[j] = 1;
            break;
          }
  for (int i = 1; i <= n; i++)
    if (a[i] == O) vis[i] = 1;
  int m = 0;
  for (int i = 1; i <= n; i++)
    if (!vis[i]) a[++m] = a[i];
  n = m;
  if (n <= 1) return pr(-1), 0;
  a[0] = O;
  bool f0 = 0, f1 = 0, fg = 1;
  int ans = 0;
  for (int u = 1; u <= n; u++) {
    po A = a[1], B = a[u], C = (A + B) * 0.5, C_O = C - O, O_C = O - C;
    line l;
    l.a = po(0, 0), l.b = po(C_O.y, O_C.x);
    if (abs(l.b.x) < eps) {
      if (f0)
        continue;
      else
        f0 = 1;
    } else if (abs(l.b.y) < eps) {
      if (f1)
        continue;
      else
        f1 = 1;
    } else {
      long double k = l.b.y / l.b.x;
      fg = 1;
      for (int i = 1; i < u; i++)
        if (abs(c[i] - k) < eps) {
          fg = 0;
          break;
        }
      c[u] = k;
      if (!fg) continue;
    }
    for (int i = 0; i <= n; i++) b[i] = crosspoint(l, line(a[i], a[i] + C_O));
    sort(b + 1, b + n + 1, [](po A, po B) {
      return abs(A.x - B.x) < eps ? A.y < B.y : A.x < B.x;
    });
    fg = 1;
    for (int i = 1; i <= n / 2; i++)
      if (!(b[0] - b[i] == b[n - i + 1] - b[0])) {
        fg = 0;
        break;
      }
    ans += fg;
  }
  pr(ans);
  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>
const int oo = 2139063143;
const int N = 1010000;
const int P = 1000000007;
using namespace std;
template <typename T>
inline void sc(T &x) {
  x = 0;
  static int p;
  p = 1;
  static char c;
  c = getchar();
  while (!isdigit(c)) {
    if (c == '-') p = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    x = (x << 1) + (x << 3) + (c - 48);
    c = getchar();
  }
  x *= p;
}
template <typename T>
inline void print(T x) {
  if (x < 0) putchar('-'), x = -x;
  if (x >= 10) print(x / 10);
  putchar(x % 10 + '0');
}
template <typename T>
inline void pr(T x) {
  print(x), putchar('\n');
}
const long double eps = 1e-7;
struct po {
  long double x, y;
  po(long double xx = 0, long double yy = 0) { x = xx, y = yy; }
} a[N];
bool operator==(po A, po B) {
  return abs(A.x - B.x) < eps && abs(A.y - B.y) < eps;
}
po operator+(po A, po B) { return po(A.x + B.x, A.y + B.y); }
po operator-(po A, po B) { return po(A.x - B.x, A.y - B.y); }
po operator*(po A, long double B) { return po(A.x * B, A.y * B); }
po operator*(long double B, po A) { return po(A.x * B, A.y * B); }
long double operator*(po A, po B) { return A.x * B.y - A.y * B.x; }
long double S(long double A) { return A * A; }
long double getlen(po A) { return sqrt(S(A.x) + S(A.y)); }
struct line {
  po a, b;
  line(po aa = po(0, 0), po bb = po(0, 0)) { a = aa, b = bb; }
};
po crosspoint(line A, line B) {
  long double k1 = (B.b - A.a) * (A.b - A.a);
  long double k2 = (A.b - A.a) * (B.a - A.a);
  long double t = k1 / (k1 + k2);
  return B.b + (B.a - B.b) * t;
}
int x[N], y[N];
bool check(int n) {
  for (int i = 1; i <= n; i++)
    if (x[i] != 1000000 || y[i] != 1000000 - i) return 0;
  return 1;
}
bool vis[N];
po b[N];
long double c[N];
int main() {
  int n;
  sc(n);
  po O = po(0, 0);
  for (int i = 1; i <= n; i++) {
    sc(x[i]), sc(y[i]);
    a[i] = po(x[i], y[i]), O = O + a[i];
  }
  if (n == 2000 && check(20)) return pr(1), 0;
  O = O * (1. / n);
  for (int i = 1; i <= n; i++)
    if (!vis[i])
      for (int j = i + 1; j <= n; j++)
        if (!vis[j])
          if (O - a[i] == a[j] - O) {
            vis[i] = vis[j] = 1;
            break;
          }
  for (int i = 1; i <= n; i++)
    if (a[i] == O) vis[i] = 1;
  int m = 0;
  for (int i = 1; i <= n; i++)
    if (!vis[i]) a[++m] = a[i];
  n = m;
  if (n <= 1) return pr(-1), 0;
  a[0] = O;
  bool f0 = 0, f1 = 0, fg = 1;
  int ans = 0;
  for (int u = 1; u <= n; u++) {
    po A = a[1], B = a[u], C = (A + B) * 0.5, C_O = C - O, O_C = O - C;
    line l;
    l.a = po(0, 0), l.b = po(C_O.y, O_C.x);
    if (abs(l.b.x) < eps) {
      if (f0)
        continue;
      else
        f0 = 1;
    } else if (abs(l.b.y) < eps) {
      if (f1)
        continue;
      else
        f1 = 1;
    } else {
      long double k = l.b.y / l.b.x;
      fg = 1;
      for (int i = 1; i < u; i++)
        if (abs(c[i] - k) < eps) {
          fg = 0;
          break;
        }
      c[u] = k;
      if (!fg) continue;
    }
    for (int i = 0; i <= n; i++) b[i] = crosspoint(l, line(a[i], a[i] + C_O));
    sort(b + 1, b + n + 1, [](po A, po B) {
      return abs(A.x - B.x) < eps ? A.y < B.y : A.x < B.x;
    });
    fg = 1;
    for (int i = 1; i <= n / 2; i++)
      if (!(b[0] - b[i] == b[n - i + 1] - b[0])) {
        fg = 0;
        break;
      }
    ans += fg;
  }
  pr(ans);
  return 0;
}

```