#include <bits/stdc++.h>
using namespace std;
const int N = 2005;
struct point {
  double x, y;
} p[N], mid, line;
point operator+(point s, point t) { return (point){s.x + t.x, s.y + t.y}; }
int n, del[N];
pair<double, int> x[N];
bool eq(double x, double y) { return fabs(x - y) < 1e-9; }
bool check1(int a, int b) {
  return eq(mid.x - p[a].x, p[b].x - mid.x) &&
         eq(mid.y - p[a].y, p[b].y - mid.y);
}
double mult(double x1, double y1, double x2, double y2) {
  return x1 * x2 + y1 * y2;
}
bool check(int a) {
  line =
      (point){mid.y - (p[1].y + p[a].y) / 2.0, (p[1].x + p[a].x) / 2.0 - mid.x};
  for (int i = 1; i <= n; ++i)
    x[i] = make_pair(mult(line.x, line.y, p[i].x, p[i].y), i);
  sort(x + 1, x + 1 + n);
  int x1 = 0, x2 = 0;
  for (int i = 1; i <= n; ++i) {
    if (x[i].second == 1) x1 = i;
    if (x[i].second == a) x2 = i;
  }
  if (x1 + x2 != n + 1) return false;
  for (int i = 2; i <= n; ++i)
    if (!eq(x[1].first + x[n].first, x[i].first + x[n - i + 1].first))
      return false;
  return true;
}
int main() {
  scanf("%d", &n);
  mid = (point){0, 0}, memset(del, false, sizeof(del));
  for (int i = 1; i <= n; ++i)
    scanf("%lf%lf", &p[i].x, &p[i].y), mid = mid + p[i];
  mid.x /= n, mid.y /= n;
  for (int i = 1; i <= n; ++i)
    for (int j = i + 1; j <= n; ++j)
      if (check1(i, j)) del[i] = del[j] = true;
  int cnt = 0, ans = 0;
  for (int i = 1; i <= n; ++i)
    if (!del[i]) p[++cnt] = p[i];
  n = cnt;
  if (n <= 2) {
    puts("-1");
    return 0;
  }
  for (int i = 1; i <= n; ++i) ans += check(i);
  printf("%d\n", ans);
}

### Prompt

In CPP, your task is to solve 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 = 2005;
struct point {
  double x, y;
} p[N], mid, line;
point operator+(point s, point t) { return (point){s.x + t.x, s.y + t.y}; }
int n, del[N];
pair<double, int> x[N];
bool eq(double x, double y) { return fabs(x - y) < 1e-9; }
bool check1(int a, int b) {
  return eq(mid.x - p[a].x, p[b].x - mid.x) &&
         eq(mid.y - p[a].y, p[b].y - mid.y);
}
double mult(double x1, double y1, double x2, double y2) {
  return x1 * x2 + y1 * y2;
}
bool check(int a) {
  line =
      (point){mid.y - (p[1].y + p[a].y) / 2.0, (p[1].x + p[a].x) / 2.0 - mid.x};
  for (int i = 1; i <= n; ++i)
    x[i] = make_pair(mult(line.x, line.y, p[i].x, p[i].y), i);
  sort(x + 1, x + 1 + n);
  int x1 = 0, x2 = 0;
  for (int i = 1; i <= n; ++i) {
    if (x[i].second == 1) x1 = i;
    if (x[i].second == a) x2 = i;
  }
  if (x1 + x2 != n + 1) return false;
  for (int i = 2; i <= n; ++i)
    if (!eq(x[1].first + x[n].first, x[i].first + x[n - i + 1].first))
      return false;
  return true;
}
int main() {
  scanf("%d", &n);
  mid = (point){0, 0}, memset(del, false, sizeof(del));
  for (int i = 1; i <= n; ++i)
    scanf("%lf%lf", &p[i].x, &p[i].y), mid = mid + p[i];
  mid.x /= n, mid.y /= n;
  for (int i = 1; i <= n; ++i)
    for (int j = i + 1; j <= n; ++j)
      if (check1(i, j)) del[i] = del[j] = true;
  int cnt = 0, ans = 0;
  for (int i = 1; i <= n; ++i)
    if (!del[i]) p[++cnt] = p[i];
  n = cnt;
  if (n <= 2) {
    puts("-1");
    return 0;
  }
  for (int i = 1; i <= n; ++i) ans += check(i);
  printf("%d\n", ans);
}

```