#include <bits/stdc++.h>
using namespace std;
const long double EPS = 1e-9;
inline bool eq(long double x, long double y) { return fabs(x - y) < EPS; }
inline bool le(long double x, long double y) { return x + EPS < y; }
inline bool lt(long double x, long double y) { return x < y + EPS; }
inline int sgn(long double x) { return eq(x, 0) ? 0 : x < 0 ? -1 : 1; }
struct point {
  long double x, y;
  point(long double x = 0, long double y = 0) : x(x), y(y) {}
  point operator+(const point& p) const { return point(x + p.x, y + p.y); }
  point operator-(const point& p) const { return point(x - p.x, y - p.y); }
  point operator*(long double s) { return point(x * s, y * s); }
  point operator/(long double s) { return point(x / s, y / s); }
  long double operator*(const point& p) const { return x * p.x + y * p.y; }
  long double operator%(const point& p) const { return x * p.y - y * p.x; }
  bool operator==(const point& p) const { return eq(x, p.x) && eq(y, p.y); }
  bool operator<(const point& p) const {
    return eq(y, p.y) ? lt(x, p.x) : lt(y, p.y);
  }
};
int ccw(point a, point b, point c) { return sgn((b - a) % (c - b)); }
struct line {
  point a, ab;
  line(point a, point b) {
    if (b < a) swap(a, b);
    a = a;
    ab = b - a;
  }
  bool isParallel(const line& l) const { return eq(ab % l.ab, 0); }
  bool operator<(const line& l) const { return sgn(ab % l.ab) > 0; }
  bool onLine(const point& p) const { return eq((p - a) % ab, 0); }
  bool operator==(const line& l) const { return isParallel(l); }
};
point perp(point p) { return point(-p.y, p.x); }
const int N = 2048;
point p[N];
bool die[N];
int n;
point mid;
bool process(line l) {
  vector<long double> projection;
  point ab = perp(l.ab);
  long double offset = ab * mid;
  for (int i = 0; i < n; ++i) {
    long double val = p[i] * ab;
    projection.push_back(val - offset);
  }
  sort(projection.begin(), projection.end());
  for (int i = 0, j = (int)projection.size() - 1; i < j; ++i, --j) {
    if (!eq(-projection[i], projection[j])) return false;
  }
  return true;
}
int main() {
  scanf("%d", &n);
  mid = point(0, 0);
  for (int i = 0; i < n; ++i) {
    int x, y;
    scanf("%d %d", &x, &y);
    p[i] = point(x, y);
    mid = mid + p[i];
  }
  mid = mid / n;
  int cnt = 0;
  for (int i = 0; i < n; ++i) {
    if (die[i]) continue;
    for (int j = i + 1; j < n; ++j) {
      if (die[j]) continue;
      if ((p[i] - mid) == (mid - p[j])) {
        die[i] = 1;
        die[j] = 1;
        break;
      }
    }
    cnt += !die[i];
  }
  if (cnt <= 1) {
    puts("-1");
    return 0;
  }
  for (int i = 0, j = 0; i < cnt; ++i, ++j) {
    while (die[j]) ++j;
    p[i] = p[j];
  }
  n = cnt;
  vector<line> vl;
  for (int i = 0; i < n; ++i) {
    for (int j = i + 1; j < n; ++j) {
      point c = (p[i] + p[j]) / 2.0;
      vl.push_back(line(c, mid));
    }
  }
  sort(vl.begin(), vl.end());
  line cur = vl[0];
  cnt = 0;
  int ans = 0;
  for (int i = 0; i < vl.size(); ++i) {
    if (vl[i] == cur)
      ++cnt;
    else {
      if (cnt * 2 + 1 >= n) {
        ans += process(cur);
      }
      cnt = 1;
      cur = vl[i];
    }
  }
  if (cnt * 2 + 1 >= n) {
    ans += process(cur);
  }
  printf("%d\n", ans);
  return 0;
}

### Prompt

Please provide a CPP coded solution to the problem described below:

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 long double EPS = 1e-9;
inline bool eq(long double x, long double y) { return fabs(x - y) < EPS; }
inline bool le(long double x, long double y) { return x + EPS < y; }
inline bool lt(long double x, long double y) { return x < y + EPS; }
inline int sgn(long double x) { return eq(x, 0) ? 0 : x < 0 ? -1 : 1; }
struct point {
  long double x, y;
  point(long double x = 0, long double y = 0) : x(x), y(y) {}
  point operator+(const point& p) const { return point(x + p.x, y + p.y); }
  point operator-(const point& p) const { return point(x - p.x, y - p.y); }
  point operator*(long double s) { return point(x * s, y * s); }
  point operator/(long double s) { return point(x / s, y / s); }
  long double operator*(const point& p) const { return x * p.x + y * p.y; }
  long double operator%(const point& p) const { return x * p.y - y * p.x; }
  bool operator==(const point& p) const { return eq(x, p.x) && eq(y, p.y); }
  bool operator<(const point& p) const {
    return eq(y, p.y) ? lt(x, p.x) : lt(y, p.y);
  }
};
int ccw(point a, point b, point c) { return sgn((b - a) % (c - b)); }
struct line {
  point a, ab;
  line(point a, point b) {
    if (b < a) swap(a, b);
    a = a;
    ab = b - a;
  }
  bool isParallel(const line& l) const { return eq(ab % l.ab, 0); }
  bool operator<(const line& l) const { return sgn(ab % l.ab) > 0; }
  bool onLine(const point& p) const { return eq((p - a) % ab, 0); }
  bool operator==(const line& l) const { return isParallel(l); }
};
point perp(point p) { return point(-p.y, p.x); }
const int N = 2048;
point p[N];
bool die[N];
int n;
point mid;
bool process(line l) {
  vector<long double> projection;
  point ab = perp(l.ab);
  long double offset = ab * mid;
  for (int i = 0; i < n; ++i) {
    long double val = p[i] * ab;
    projection.push_back(val - offset);
  }
  sort(projection.begin(), projection.end());
  for (int i = 0, j = (int)projection.size() - 1; i < j; ++i, --j) {
    if (!eq(-projection[i], projection[j])) return false;
  }
  return true;
}
int main() {
  scanf("%d", &n);
  mid = point(0, 0);
  for (int i = 0; i < n; ++i) {
    int x, y;
    scanf("%d %d", &x, &y);
    p[i] = point(x, y);
    mid = mid + p[i];
  }
  mid = mid / n;
  int cnt = 0;
  for (int i = 0; i < n; ++i) {
    if (die[i]) continue;
    for (int j = i + 1; j < n; ++j) {
      if (die[j]) continue;
      if ((p[i] - mid) == (mid - p[j])) {
        die[i] = 1;
        die[j] = 1;
        break;
      }
    }
    cnt += !die[i];
  }
  if (cnt <= 1) {
    puts("-1");
    return 0;
  }
  for (int i = 0, j = 0; i < cnt; ++i, ++j) {
    while (die[j]) ++j;
    p[i] = p[j];
  }
  n = cnt;
  vector<line> vl;
  for (int i = 0; i < n; ++i) {
    for (int j = i + 1; j < n; ++j) {
      point c = (p[i] + p[j]) / 2.0;
      vl.push_back(line(c, mid));
    }
  }
  sort(vl.begin(), vl.end());
  line cur = vl[0];
  cnt = 0;
  int ans = 0;
  for (int i = 0; i < vl.size(); ++i) {
    if (vl[i] == cur)
      ++cnt;
    else {
      if (cnt * 2 + 1 >= n) {
        ans += process(cur);
      }
      cnt = 1;
      cur = vl[i];
    }
  }
  if (cnt * 2 + 1 >= n) {
    ans += process(cur);
  }
  printf("%d\n", ans);
  return 0;
}

```