#include <bits/stdc++.h>
using namespace std;
namespace IO {
const unsigned int Buffsize = 1 << 15, Output = 1 << 23;
static char Ch[Buffsize], *S = Ch, *T = Ch;
inline char getc() {
  return ((S == T) && (T = (S = Ch) + fread(Ch, 1, Buffsize, stdin), S == T)
              ? 0
              : *S++);
}
static char Out[Output], *nowps = Out;
inline void flush() {
  fwrite(Out, 1, nowps - Out, stdout);
  nowps = Out;
}
template <typename T>
inline void read(T& x) {
  x = 0;
  static char ch;
  T f = 1;
  for (ch = getc(); !isdigit(ch); ch = getc())
    if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getc()) x = x * 10 + (ch ^ 48);
  x *= f;
}
template <typename T>
inline void write(T x, char ch = '\n') {
  if (!x) *nowps++ = '0';
  if (x < 0) *nowps++ = '-', x = -x;
  static unsigned int sta[111], tp;
  for (tp = 0; x; x /= 10) sta[++tp] = x % 10;
  for (; tp; *nowps++ = sta[tp--] ^ 48)
    ;
  *nowps++ = ch;
}
}  // namespace IO
using namespace IO;
inline void file() {}
const int MAXN = 2011;
static int n, x, y;
static long double sx, sy;
static struct node {
  double x, y;
  friend bool operator<(node a, node b) {
    return fabs(a.x - b.x) > 1e-8 ? a.x < b.x : a.y < b.y;
  }
  friend bool operator==(node a, node b) {
    return fabs(a.x - b.x) + fabs(a.y - b.y) < 1e-8;
  }
} p[MAXN], q[MAXN * MAXN];
inline void init() {
  read(n);
  sx = sy = 0;
  for (register int i = (1); i <= (n); ++i)
    read(p[i].x), read(p[i].y), sx += p[i].x, sy += p[i].y;
}
static int tt;
static int nf;
static double shad[MAXN];
inline double getshadow(double x, double y, double u, double v) {
  return (x * v - y * u > 0 ? -1 : 1) *
         sqrt(x * x + y * y -
              (x * u + y * v) * (x * u + y * v) / (u * u + v * v));
}
inline int Chk(double x, double y) {
  for (register int i = (1); i <= (n); ++i)
    shad[i] = getshadow(p[i].x, p[i].y, x, y);
  sort(shad + 1, shad + n + 1);
  double md = getshadow(sx, sy, x, y);
  for (register int i = (1); i <= (n / 2); ++i)
    if (fabs(2 * md - shad[i] - shad[n - i + 1]) > 1e-8) return 0;
  return 1;
}
inline void solve() {
  sx /= n, sy /= n;
  sort(p + 1, p + n + 1), n = unique(p + 1, p + n + 1) - p - 1;
  for (register int i = (1); i <= (n); ++i)
    q[i].x = 2 * sx - p[i].x, q[i].y = 2 * sy - p[i].y;
  tt = 0;
  for (register int i = (1); i <= (n); ++i) {
    int flg = 1;
    for (register int j = (1); j <= (n); ++j)
      if (fabs(p[i].x - q[j].x) + fabs(p[i].y - q[j].y) <= 1e-8) {
        flg = 0;
        break;
      }
    if (flg) p[++tt] = p[i];
  }
  n = tt, tt = 0;
  if (n <= 2) puts("-1"), exit(0);
  for (register int i = (1); i <= (n - 1); ++i)
    for (register int j = (i + 1); j <= (n); ++j) {
      double x = 2 * sx - p[j].x - p[i].x, y = 2 * sy - p[j].y - p[i].y;
      if (fabs(x) > 0)
        y /= x, x = 1;
      else
        x = 0, y = 1;
      q[++tt] = (node){x, y};
    }
  sort(q + 1, q + tt + 1);
  int fp = 1;
  int ans = 0;
  for (register int i = (1); i <= (tt + 1); ++i) {
    if (fabs(q[i].x - q[fp].x) + fabs(q[i].y - q[fp].y) <= 1e-8) continue;
    if (i - fp < n / 2) {
      fp = i;
      continue;
    }
    if (Chk(q[fp].x, q[fp].y)) ++ans;
    fp = i;
  }
  cout << ans << endl;
}
int main() {
  init();
  solve();
  return 0;
}

### Prompt

Your challenge is to write 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>
using namespace std;
namespace IO {
const unsigned int Buffsize = 1 << 15, Output = 1 << 23;
static char Ch[Buffsize], *S = Ch, *T = Ch;
inline char getc() {
  return ((S == T) && (T = (S = Ch) + fread(Ch, 1, Buffsize, stdin), S == T)
              ? 0
              : *S++);
}
static char Out[Output], *nowps = Out;
inline void flush() {
  fwrite(Out, 1, nowps - Out, stdout);
  nowps = Out;
}
template <typename T>
inline void read(T& x) {
  x = 0;
  static char ch;
  T f = 1;
  for (ch = getc(); !isdigit(ch); ch = getc())
    if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getc()) x = x * 10 + (ch ^ 48);
  x *= f;
}
template <typename T>
inline void write(T x, char ch = '\n') {
  if (!x) *nowps++ = '0';
  if (x < 0) *nowps++ = '-', x = -x;
  static unsigned int sta[111], tp;
  for (tp = 0; x; x /= 10) sta[++tp] = x % 10;
  for (; tp; *nowps++ = sta[tp--] ^ 48)
    ;
  *nowps++ = ch;
}
}  // namespace IO
using namespace IO;
inline void file() {}
const int MAXN = 2011;
static int n, x, y;
static long double sx, sy;
static struct node {
  double x, y;
  friend bool operator<(node a, node b) {
    return fabs(a.x - b.x) > 1e-8 ? a.x < b.x : a.y < b.y;
  }
  friend bool operator==(node a, node b) {
    return fabs(a.x - b.x) + fabs(a.y - b.y) < 1e-8;
  }
} p[MAXN], q[MAXN * MAXN];
inline void init() {
  read(n);
  sx = sy = 0;
  for (register int i = (1); i <= (n); ++i)
    read(p[i].x), read(p[i].y), sx += p[i].x, sy += p[i].y;
}
static int tt;
static int nf;
static double shad[MAXN];
inline double getshadow(double x, double y, double u, double v) {
  return (x * v - y * u > 0 ? -1 : 1) *
         sqrt(x * x + y * y -
              (x * u + y * v) * (x * u + y * v) / (u * u + v * v));
}
inline int Chk(double x, double y) {
  for (register int i = (1); i <= (n); ++i)
    shad[i] = getshadow(p[i].x, p[i].y, x, y);
  sort(shad + 1, shad + n + 1);
  double md = getshadow(sx, sy, x, y);
  for (register int i = (1); i <= (n / 2); ++i)
    if (fabs(2 * md - shad[i] - shad[n - i + 1]) > 1e-8) return 0;
  return 1;
}
inline void solve() {
  sx /= n, sy /= n;
  sort(p + 1, p + n + 1), n = unique(p + 1, p + n + 1) - p - 1;
  for (register int i = (1); i <= (n); ++i)
    q[i].x = 2 * sx - p[i].x, q[i].y = 2 * sy - p[i].y;
  tt = 0;
  for (register int i = (1); i <= (n); ++i) {
    int flg = 1;
    for (register int j = (1); j <= (n); ++j)
      if (fabs(p[i].x - q[j].x) + fabs(p[i].y - q[j].y) <= 1e-8) {
        flg = 0;
        break;
      }
    if (flg) p[++tt] = p[i];
  }
  n = tt, tt = 0;
  if (n <= 2) puts("-1"), exit(0);
  for (register int i = (1); i <= (n - 1); ++i)
    for (register int j = (i + 1); j <= (n); ++j) {
      double x = 2 * sx - p[j].x - p[i].x, y = 2 * sy - p[j].y - p[i].y;
      if (fabs(x) > 0)
        y /= x, x = 1;
      else
        x = 0, y = 1;
      q[++tt] = (node){x, y};
    }
  sort(q + 1, q + tt + 1);
  int fp = 1;
  int ans = 0;
  for (register int i = (1); i <= (tt + 1); ++i) {
    if (fabs(q[i].x - q[fp].x) + fabs(q[i].y - q[fp].y) <= 1e-8) continue;
    if (i - fp < n / 2) {
      fp = i;
      continue;
    }
    if (Chk(q[fp].x, q[fp].y)) ++ans;
    fp = i;
  }
  cout << ans << endl;
}
int main() {
  init();
  solve();
  return 0;
}

```