#include <bits/stdc++.h>
using namespace std;
const int N = 2020;
const double eps = 1e-12;
int fcmp(double x) { return fabs(x) > eps ? (x < 0 ? -1 : 1) : 0; }
struct Point {
  double x, y;
  Point Conj(void) { return (Point){-y, x}; }
  double operator^(const Point &rhs) const { return x * rhs.y - y * rhs.x; }
  double operator*(const Point &rhs) const { return x * rhs.x + y * rhs.y; }
  Point operator+(const Point &rhs) const {
    return (Point){x + rhs.x, y + rhs.y};
  }
  Point operator-(const Point &rhs) const {
    return (Point){x - rhs.x, y - rhs.y};
  }
  Point operator/(const double &rhs) const { return (Point){x / rhs, y / rhs}; }
  double Len(void) const { return x * x + y * y; }
} p[N], Grv;
struct Info {
  Point p;
  int u, v;
  double slope;
  bool operator<(const Info &rhs) const { return fcmp(slope - rhs.slope) < 0; }
};
int n, vis[N];
int main(void) {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%lf%lf", &p[i].x, &p[i].y);
    Grv = Grv + p[i];
  }
  Grv = Grv / n;
  for (int i = 1; i < n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if (!fcmp((p[j] - Grv).Len() - (p[i] - Grv).Len()) &&
          !fcmp((p[j] - Grv) ^ (p[i] - Grv))) {
        vis[i] = 1;
        vis[j] = 1;
      }
    }
  }
  int m = 0;
  for (int i = 1; i <= n; i++) {
    if (vis[i]) continue;
    p[++m] = p[i];
  }
  n = m;
  if (n <= 2) {
    puts("-1");
    return 0;
  }
  Point now;
  vector<Info> E;
  int Ans = 0;
  for (int i = 1; i < n; i++) {
    for (int j = i + 1; j <= n; j++) {
      now = (Point){2 * Grv.y - p[i].y - p[j].y, p[i].x + p[j].x - 2 * Grv.x};
      if (fcmp(now.y) < 0) {
        now.x = -now.x;
        now.y = -now.y;
      }
      if (!fcmp(now.y) && fcmp(now.x) > 0) {
        now.x = -now.x;
      }
      E.push_back((Info){now, i, j, atan2(now.y, now.x)});
    }
  }
  sort(E.begin(), E.end());
  for (int i = 0; i < E.size(); i++) {
    int j = i;
    while (j + 1 < E.size() && !fcmp(E[j + 1].p ^ E[i].p)) {
      j++;
    }
    if (j - i + 1 >= n / 2) {
      for (int k = 1; k <= n; k++) {
        vis[k] = 0;
      }
      for (int k = i; k <= j; k++) {
        if (vis[E[k].u] || vis[E[k].v]) {
          continue;
        }
        vis[E[k].u] = 1;
        vis[E[k].v] = 1;
      }
      int cnt = 0, id;
      for (int k = 1; k <= n; k++) {
        if (!vis[k]) {
          cnt++;
          id = k;
        }
      }
      if (cnt > 1 && (n & 1) || cnt && (~n & 1)) {
        continue;
      }
      if (!cnt || !fcmp(E[i].p * (p[id] - Grv))) {
        Ans++;
      }
    }
    i = j;
  }
  cout << Ans << endl;
  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;
const int N = 2020;
const double eps = 1e-12;
int fcmp(double x) { return fabs(x) > eps ? (x < 0 ? -1 : 1) : 0; }
struct Point {
  double x, y;
  Point Conj(void) { return (Point){-y, x}; }
  double operator^(const Point &rhs) const { return x * rhs.y - y * rhs.x; }
  double operator*(const Point &rhs) const { return x * rhs.x + y * rhs.y; }
  Point operator+(const Point &rhs) const {
    return (Point){x + rhs.x, y + rhs.y};
  }
  Point operator-(const Point &rhs) const {
    return (Point){x - rhs.x, y - rhs.y};
  }
  Point operator/(const double &rhs) const { return (Point){x / rhs, y / rhs}; }
  double Len(void) const { return x * x + y * y; }
} p[N], Grv;
struct Info {
  Point p;
  int u, v;
  double slope;
  bool operator<(const Info &rhs) const { return fcmp(slope - rhs.slope) < 0; }
};
int n, vis[N];
int main(void) {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%lf%lf", &p[i].x, &p[i].y);
    Grv = Grv + p[i];
  }
  Grv = Grv / n;
  for (int i = 1; i < n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if (!fcmp((p[j] - Grv).Len() - (p[i] - Grv).Len()) &&
          !fcmp((p[j] - Grv) ^ (p[i] - Grv))) {
        vis[i] = 1;
        vis[j] = 1;
      }
    }
  }
  int m = 0;
  for (int i = 1; i <= n; i++) {
    if (vis[i]) continue;
    p[++m] = p[i];
  }
  n = m;
  if (n <= 2) {
    puts("-1");
    return 0;
  }
  Point now;
  vector<Info> E;
  int Ans = 0;
  for (int i = 1; i < n; i++) {
    for (int j = i + 1; j <= n; j++) {
      now = (Point){2 * Grv.y - p[i].y - p[j].y, p[i].x + p[j].x - 2 * Grv.x};
      if (fcmp(now.y) < 0) {
        now.x = -now.x;
        now.y = -now.y;
      }
      if (!fcmp(now.y) && fcmp(now.x) > 0) {
        now.x = -now.x;
      }
      E.push_back((Info){now, i, j, atan2(now.y, now.x)});
    }
  }
  sort(E.begin(), E.end());
  for (int i = 0; i < E.size(); i++) {
    int j = i;
    while (j + 1 < E.size() && !fcmp(E[j + 1].p ^ E[i].p)) {
      j++;
    }
    if (j - i + 1 >= n / 2) {
      for (int k = 1; k <= n; k++) {
        vis[k] = 0;
      }
      for (int k = i; k <= j; k++) {
        if (vis[E[k].u] || vis[E[k].v]) {
          continue;
        }
        vis[E[k].u] = 1;
        vis[E[k].v] = 1;
      }
      int cnt = 0, id;
      for (int k = 1; k <= n; k++) {
        if (!vis[k]) {
          cnt++;
          id = k;
        }
      }
      if (cnt > 1 && (n & 1) || cnt && (~n & 1)) {
        continue;
      }
      if (!cnt || !fcmp(E[i].p * (p[id] - Grv))) {
        Ans++;
      }
    }
    i = j;
  }
  cout << Ans << endl;
  return 0;
}

```