#include <bits/stdc++.h>
using namespace std;
int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch) && ch != '-') ch = getchar();
  if (ch == '-') f = 0, ch = getchar();
  while (isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
  return f ? x : -x;
}
const long double Eps = 1e-6;
int Dcmp(long double x) {
  if (fabs(x) < Eps) return 0;
  return x < 0 ? -1 : 1;
}
const int N = 2005;
int n;
struct Point {
  long double x, y;
  Point() {}
  Point(long double _x, long double _y) { x = _x, y = _y; }
  friend Point operator+(Point A, Point B) {
    return Point(A.x + B.x, A.y + B.y);
  }
  friend Point operator-(Point A, Point B) {
    return Point(A.x - B.x, A.y - B.y);
  }
  friend Point operator*(Point A, long double x) {
    return Point(A.x * x, A.y * x);
  }
  friend Point operator/(Point A, long double x) {
    return Point(A.x / x, A.y / x);
  }
  friend bool operator==(Point A, Point B) {
    return !Dcmp(A.x - B.x) && !Dcmp(A.y - B.y);
  }
  friend bool operator<(Point A, Point B) {
    if (Dcmp(A.x - B.x)) return A.x < B.x;
    return A.y < B.y;
  }
} p[N], G(0, 0);
int vis[N];
void del() {
  int _n = 0;
  for (int i = 1; i <= n; i++)
    if (!vis[i]) p[++_n] = p[i];
  n = _n;
}
Point ans[N];
int tot = 0;
multiset<long double> S;
multiset<long double>::iterator sp;
void solve(Point L) {
  L = Point(L.y, -L.x);
  long double Sin = L.y / sqrt(L.x * L.x + L.y * L.y);
  long double Cos = L.x / sqrt(L.x * L.x + L.y * L.y);
  if (Sin < 0) Sin = -Sin, Cos = -Cos;
  if (fabs(Sin) < Eps) Sin = fabs(Sin), Cos = fabs(Cos);
  S.clear();
  long double dG = L.x * G.x + L.y * G.y;
  for (int i = 1; i <= n; i++) {
    long double d = L.x * p[i].x + L.y * p[i].y;
    if (!Dcmp(d - dG)) continue;
    sp = S.lower_bound(dG * 2 - d - 1e-7);
    if (sp != S.end() && !Dcmp(d + *sp - dG * 2))
      S.erase(sp);
    else
      S.insert(d);
  }
  if (S.empty()) ans[++tot] = Point(Sin, Cos);
}
int Main() {
  n = read();
  for (int i = 1; i <= n; i++) {
    p[i].x = read(), p[i].y = read();
    G = G + p[i];
  }
  G = G / n;
  for (int i = 1; i <= n; i++) {
    if (vis[i]) continue;
    for (int j = 1; j <= n; j++)
      if (G * 2 - p[i] == p[j]) {
        vis[i] = vis[j] = 1;
        break;
      }
  }
  del();
  if (!n) return puts("-1"), 0;
  for (int i = 1; i <= n; i++) solve((p[1] + p[i]) / 2 - G);
  sort(ans + 1, ans + tot + 1);
  int res = min(tot, 1);
  for (int i = 2; i <= tot; i++)
    if (!(ans[i] == ans[i - 1])) res++;
  cout << res << endl;
  return 0;
}
int main() {
  int T = 1;
  while (T--) {
    tot = 0;
    G = Point(0, 0);
    Main();
  }
}

### Prompt

Generate 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;
int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch) && ch != '-') ch = getchar();
  if (ch == '-') f = 0, ch = getchar();
  while (isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
  return f ? x : -x;
}
const long double Eps = 1e-6;
int Dcmp(long double x) {
  if (fabs(x) < Eps) return 0;
  return x < 0 ? -1 : 1;
}
const int N = 2005;
int n;
struct Point {
  long double x, y;
  Point() {}
  Point(long double _x, long double _y) { x = _x, y = _y; }
  friend Point operator+(Point A, Point B) {
    return Point(A.x + B.x, A.y + B.y);
  }
  friend Point operator-(Point A, Point B) {
    return Point(A.x - B.x, A.y - B.y);
  }
  friend Point operator*(Point A, long double x) {
    return Point(A.x * x, A.y * x);
  }
  friend Point operator/(Point A, long double x) {
    return Point(A.x / x, A.y / x);
  }
  friend bool operator==(Point A, Point B) {
    return !Dcmp(A.x - B.x) && !Dcmp(A.y - B.y);
  }
  friend bool operator<(Point A, Point B) {
    if (Dcmp(A.x - B.x)) return A.x < B.x;
    return A.y < B.y;
  }
} p[N], G(0, 0);
int vis[N];
void del() {
  int _n = 0;
  for (int i = 1; i <= n; i++)
    if (!vis[i]) p[++_n] = p[i];
  n = _n;
}
Point ans[N];
int tot = 0;
multiset<long double> S;
multiset<long double>::iterator sp;
void solve(Point L) {
  L = Point(L.y, -L.x);
  long double Sin = L.y / sqrt(L.x * L.x + L.y * L.y);
  long double Cos = L.x / sqrt(L.x * L.x + L.y * L.y);
  if (Sin < 0) Sin = -Sin, Cos = -Cos;
  if (fabs(Sin) < Eps) Sin = fabs(Sin), Cos = fabs(Cos);
  S.clear();
  long double dG = L.x * G.x + L.y * G.y;
  for (int i = 1; i <= n; i++) {
    long double d = L.x * p[i].x + L.y * p[i].y;
    if (!Dcmp(d - dG)) continue;
    sp = S.lower_bound(dG * 2 - d - 1e-7);
    if (sp != S.end() && !Dcmp(d + *sp - dG * 2))
      S.erase(sp);
    else
      S.insert(d);
  }
  if (S.empty()) ans[++tot] = Point(Sin, Cos);
}
int Main() {
  n = read();
  for (int i = 1; i <= n; i++) {
    p[i].x = read(), p[i].y = read();
    G = G + p[i];
  }
  G = G / n;
  for (int i = 1; i <= n; i++) {
    if (vis[i]) continue;
    for (int j = 1; j <= n; j++)
      if (G * 2 - p[i] == p[j]) {
        vis[i] = vis[j] = 1;
        break;
      }
  }
  del();
  if (!n) return puts("-1"), 0;
  for (int i = 1; i <= n; i++) solve((p[1] + p[i]) / 2 - G);
  sort(ans + 1, ans + tot + 1);
  int res = min(tot, 1);
  for (int i = 2; i <= tot; i++)
    if (!(ans[i] == ans[i - 1])) res++;
  cout << res << endl;
  return 0;
}
int main() {
  int T = 1;
  while (T--) {
    tot = 0;
    G = Point(0, 0);
    Main();
  }
}

```