#include <bits/stdc++.h>
using namespace std;
const int N = 2005;
const long double ep = 1e-10;
struct pnt {
  long double x, y;
  pnt() { x = y = 0; }
  pnt(long double xx, long double yy) { x = xx, y = yy; }
  pnt operator+(pnt a) { return pnt(x + a.x, y + a.y); }
  void in() {
    int xx, yy;
    cin >> xx >> yy;
    x = xx, y = yy;
  }
  long double operator^(const pnt &a) const { return x * a.y - y * a.x; }
  bool operator<(const pnt &a) const { return x != a.x ? x < a.x : y < a.y; }
  bool int_pnt(pnt &a) {
    int xx = x + (x > 0 ? 0.5 : -0.5), yy = y + (y > 0 ? 0.5 : -0.5);
    if (abs(x - xx) < ep && abs(y - yy) < ep) {
      a = pnt(xx, yy);
      return 1;
    }
    return 0;
  }
} p[N], M, MM;
vector<pnt> P;
int n;
map<pnt, int> h;
bool opp[N];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    p[i].in();
    M = M + p[i];
    h[p[i]] = i;
  }
  M.x /= n, M.y /= n;
  MM.x = M.x * 2, MM.y = M.y * 2;
  for (int i = 1; i <= n; i++)
    if (!opp[i]) {
      pnt pp = pnt(MM.x - p[i].x, MM.y - p[i].y), qq;
      if (pp.int_pnt(qq) && h.count(qq)) {
        int t = h[qq];
        opp[t] = 1;
        opp[i] = 1;
      }
    }
  for (int i = 1; i <= n; i++)
    if (!opp[i]) P.push_back(p[i]);
  if (P.empty())
    puts("-1");
  else {
    pnt A = P[0];
    int ans = 0;
    vector<pnt> D;
    for (auto x : P) {
      pnt AM = A + x;
      AM.x /= 2, AM.y /= 2;
      pnt d = pnt(M.x - AM.x, M.y - AM.y);
      vector<long double> pos, neg;
      for (auto y : P) {
        long double l = d ^ pnt(y.x - AM.x, y.y - AM.y);
        if (abs(l) < ep) continue;
        if (l < 0)
          neg.push_back(-l);
        else
          pos.push_back(l);
      }
      if (neg.size() != pos.size()) continue;
      sort(neg.begin(), neg.end());
      sort(pos.begin(), pos.end());
      bool flag = 0;
      for (int i = 0; i < pos.size(); i++)
        if (abs(pos[i] - neg[i]) > ep) flag = 1;
      if (!flag) D.push_back(d);
    }
    for (auto &x : D) {
      if (x.y < 0) x.y = -x.y, x.x = -x.x;
      if (x.y == 0 && x.x < 0) x.x = -x.x;
    }
    sort(D.begin(), D.end(),
         [](const pnt &x, const pnt &y) { return (x ^ y) > 0; });
    int sz = D.size();
    for (int i = 0, j; i < sz; i = j) {
      for (j = i; j < sz && (D[i] ^ D[j]) == 0; j++)
        ;
      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 int N = 2005;
const long double ep = 1e-10;
struct pnt {
  long double x, y;
  pnt() { x = y = 0; }
  pnt(long double xx, long double yy) { x = xx, y = yy; }
  pnt operator+(pnt a) { return pnt(x + a.x, y + a.y); }
  void in() {
    int xx, yy;
    cin >> xx >> yy;
    x = xx, y = yy;
  }
  long double operator^(const pnt &a) const { return x * a.y - y * a.x; }
  bool operator<(const pnt &a) const { return x != a.x ? x < a.x : y < a.y; }
  bool int_pnt(pnt &a) {
    int xx = x + (x > 0 ? 0.5 : -0.5), yy = y + (y > 0 ? 0.5 : -0.5);
    if (abs(x - xx) < ep && abs(y - yy) < ep) {
      a = pnt(xx, yy);
      return 1;
    }
    return 0;
  }
} p[N], M, MM;
vector<pnt> P;
int n;
map<pnt, int> h;
bool opp[N];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    p[i].in();
    M = M + p[i];
    h[p[i]] = i;
  }
  M.x /= n, M.y /= n;
  MM.x = M.x * 2, MM.y = M.y * 2;
  for (int i = 1; i <= n; i++)
    if (!opp[i]) {
      pnt pp = pnt(MM.x - p[i].x, MM.y - p[i].y), qq;
      if (pp.int_pnt(qq) && h.count(qq)) {
        int t = h[qq];
        opp[t] = 1;
        opp[i] = 1;
      }
    }
  for (int i = 1; i <= n; i++)
    if (!opp[i]) P.push_back(p[i]);
  if (P.empty())
    puts("-1");
  else {
    pnt A = P[0];
    int ans = 0;
    vector<pnt> D;
    for (auto x : P) {
      pnt AM = A + x;
      AM.x /= 2, AM.y /= 2;
      pnt d = pnt(M.x - AM.x, M.y - AM.y);
      vector<long double> pos, neg;
      for (auto y : P) {
        long double l = d ^ pnt(y.x - AM.x, y.y - AM.y);
        if (abs(l) < ep) continue;
        if (l < 0)
          neg.push_back(-l);
        else
          pos.push_back(l);
      }
      if (neg.size() != pos.size()) continue;
      sort(neg.begin(), neg.end());
      sort(pos.begin(), pos.end());
      bool flag = 0;
      for (int i = 0; i < pos.size(); i++)
        if (abs(pos[i] - neg[i]) > ep) flag = 1;
      if (!flag) D.push_back(d);
    }
    for (auto &x : D) {
      if (x.y < 0) x.y = -x.y, x.x = -x.x;
      if (x.y == 0 && x.x < 0) x.x = -x.x;
    }
    sort(D.begin(), D.end(),
         [](const pnt &x, const pnt &y) { return (x ^ y) > 0; });
    int sz = D.size();
    for (int i = 0, j; i < sz; i = j) {
      for (j = i; j < sz && (D[i] ^ D[j]) == 0; j++)
        ;
      ans++;
    }
    printf("%d\n", ans);
  }
  return 0;
}

```