#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-8;
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
struct Dir {
  double a, b;
  Dir() {}
  Dir(double aa, double bb) {
    double len = sqrt(aa * aa + bb * bb);
    a = aa / len;
    b = bb / len;
    if (fabs(a) < eps) {
      if (b < 0) {
        b = -b;
        a = -a;
      }
    } else if (a < 0) {
      a = -a;
      b = -b;
    }
  }
};
bool cmp(Dir a, Dir b) { return a.a < b.a || (a.a == b.a && a.b < b.b); }
bool eq(Dir a, Dir b) { return fabs(a.a - b.a) < eps && fabs(a.b - b.b) < eps; }
struct Point {
  double x, y;
  Point(double xx = 0, double yy = 0) {
    x = xx;
    y = yy;
  }
} p[2010];
bool operator==(const Point& a, const Point& b) {
  return fabs(a.x - b.x) < eps && fabs(a.y - b.y) < eps;
}
Point Mid(Point a, Point b) { return Point((a.x + b.x) / 2, (a.y + b.y) / 2); }
bool vis[2010];
Dir res[2010];
int num;
double getdis(Point a, Point b) {
  if (abs(a.x) < eps) return b.x;
  double k = a.y / a.x;
  return (b.y - k * b.x) / sqrt(1 + k * k);
}
double dis[2010];
int n;
void check(Point x) {
  int N = 0;
  for (int i = 1; i <= n; i++)
    if (!vis[i]) dis[++N] = getdis(x, p[i]);
  sort(dis + 1, dis + N + 1);
  for (int i = 1; i <= N / 2; i++)
    if (fabs(dis[i] + dis[N - i + 1]) > eps) return;
  if (N % 2 == 1 && fabs(dis[N / 2 + 1]) > eps) return;
  res[++num] = Dir(x.x, x.y);
  return;
}
int main() {
  scanf("%d", &n);
  Point S;
  for (int i = 1; i <= n; i++) {
    scanf("%lf %lf", &p[i].x, &p[i].y);
    S.x += p[i].x;
    S.y += p[i].y;
  }
  S.x /= n;
  S.y /= n;
  for (int i = 1; i <= n; i++) {
    p[i].x -= S.x;
    p[i].y -= S.y;
  }
  S.x = 0;
  S.y = 0;
  int id = 0;
  for (int i = 1; i <= n; i++) {
    if (vis[i]) continue;
    if (p[i] == S) {
      vis[i] = true;
      continue;
    }
    for (int j = i + 1; j <= n; j++)
      if (!vis[j] && Mid(p[i], p[j]) == S) {
        vis[i] = vis[j] = true;
        break;
      }
    if (!vis[i]) id = i;
  }
  if (!id) {
    printf("-1\n");
    return 0;
  }
  for (int i = 1; i <= n; i++) check(Mid(p[id], p[i]));
  sort(res + 1, res + num + 1, cmp);
  int ans = min(1, num);
  for (int i = 2; i <= num; i++)
    if (!eq(res[i - 1], res[i])) ans++;
  printf("%d\n", ans);
  return 0;
}

### Prompt

Construct a CPP code solution to the problem outlined:

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 double eps = 1e-8;
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
struct Dir {
  double a, b;
  Dir() {}
  Dir(double aa, double bb) {
    double len = sqrt(aa * aa + bb * bb);
    a = aa / len;
    b = bb / len;
    if (fabs(a) < eps) {
      if (b < 0) {
        b = -b;
        a = -a;
      }
    } else if (a < 0) {
      a = -a;
      b = -b;
    }
  }
};
bool cmp(Dir a, Dir b) { return a.a < b.a || (a.a == b.a && a.b < b.b); }
bool eq(Dir a, Dir b) { return fabs(a.a - b.a) < eps && fabs(a.b - b.b) < eps; }
struct Point {
  double x, y;
  Point(double xx = 0, double yy = 0) {
    x = xx;
    y = yy;
  }
} p[2010];
bool operator==(const Point& a, const Point& b) {
  return fabs(a.x - b.x) < eps && fabs(a.y - b.y) < eps;
}
Point Mid(Point a, Point b) { return Point((a.x + b.x) / 2, (a.y + b.y) / 2); }
bool vis[2010];
Dir res[2010];
int num;
double getdis(Point a, Point b) {
  if (abs(a.x) < eps) return b.x;
  double k = a.y / a.x;
  return (b.y - k * b.x) / sqrt(1 + k * k);
}
double dis[2010];
int n;
void check(Point x) {
  int N = 0;
  for (int i = 1; i <= n; i++)
    if (!vis[i]) dis[++N] = getdis(x, p[i]);
  sort(dis + 1, dis + N + 1);
  for (int i = 1; i <= N / 2; i++)
    if (fabs(dis[i] + dis[N - i + 1]) > eps) return;
  if (N % 2 == 1 && fabs(dis[N / 2 + 1]) > eps) return;
  res[++num] = Dir(x.x, x.y);
  return;
}
int main() {
  scanf("%d", &n);
  Point S;
  for (int i = 1; i <= n; i++) {
    scanf("%lf %lf", &p[i].x, &p[i].y);
    S.x += p[i].x;
    S.y += p[i].y;
  }
  S.x /= n;
  S.y /= n;
  for (int i = 1; i <= n; i++) {
    p[i].x -= S.x;
    p[i].y -= S.y;
  }
  S.x = 0;
  S.y = 0;
  int id = 0;
  for (int i = 1; i <= n; i++) {
    if (vis[i]) continue;
    if (p[i] == S) {
      vis[i] = true;
      continue;
    }
    for (int j = i + 1; j <= n; j++)
      if (!vis[j] && Mid(p[i], p[j]) == S) {
        vis[i] = vis[j] = true;
        break;
      }
    if (!vis[i]) id = i;
  }
  if (!id) {
    printf("-1\n");
    return 0;
  }
  for (int i = 1; i <= n; i++) check(Mid(p[id], p[i]));
  sort(res + 1, res + num + 1, cmp);
  int ans = min(1, num);
  for (int i = 2; i <= num; i++)
    if (!eq(res[i - 1], res[i])) ans++;
  printf("%d\n", ans);
  return 0;
}

```