#include <bits/stdc++.h>
using namespace std;
const int MAX = 2010;
const double eps = 1e-9;
double x[MAX], y[MAX], xv, yv;
int n;
double key[MAX];
bool exist[MAX];
int tt[MAX], cnt, cnt2;
bool eq(double a, double b) { return abs(a - b) < eps; }
bool ls(double a, double b) { return a <= b - eps; }
bool gt(double a, double b) { return a >= b + eps; }
bool le(double a, double b) { return a < b + eps; }
bool ge(double a, double b) { return a > b - eps; }
struct line {
  double slope;
  line() {}
  line(double a) : slope(a) {}
  bool operator==(const line &b) const { return eq(slope, b.slope); }
  bool operator<(const line &b) const { return ls(slope, b.slope); }
};
pair<line, int> tt2[MAX];
inline double getK(const pair<double, double> &p1,
                   const pair<double, double> &p2) {
  if (p1.first == p2.first)
    return DBL_MAX;
  else
    return (p2.second - p1.second) / (p2.first - p1.first);
}
inline pair<double, double> medium(const pair<double, double> &p1,
                                   const pair<double, double> &p2) {
  return {(p1.first + p2.first) / 2, (p1.second + p2.second) / 2};
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%lf %lf", &x[i], &y[i]);
    xv += x[i], yv += y[i];
  }
  xv /= n, yv /= n;
  for (int i = 0; i < n; ++i) exist[i] = 1;
  for (int i = 0; i < n - 1; ++i) {
    if (exist[i] == 0) continue;
    for (int j = i + 1; j < n; ++j) {
      if (exist[j] == 0) continue;
      pair<double, double> mid = medium({x[i], y[i]}, {x[j], y[j]});
      if (eq(mid.first, xv) && eq(mid.second, yv)) exist[i] = exist[j] = 0;
    }
  }
  for (int i = 0; i < n; ++i)
    if (exist[i] == 1 && eq(x[i], xv) && eq(y[i], yv)) exist[i] = 0;
  for (int i = 0; i < n; ++i)
    if (exist[i] == 1) tt[cnt++] = i;
  if (cnt == 0)
    printf("%d\n", -1);
  else {
    set<line> ss;
    for (int i = 0; i < cnt; ++i) {
      pair<double, double> mid =
          medium({x[tt[0]], y[tt[0]]}, {x[tt[i]], y[tt[i]]});
      double slope =
          i ? getK(mid, {xv, yv}) : getK({x[tt[0]], y[tt[0]]}, {xv, yv});
      if (slope == 0)
        slope = DBL_MAX;
      else if (slope == DBL_MAX)
        slope = 0;
      else
        slope = -(1 / slope);
      map<line, int> mm;
      double midK =
          slope == DBL_MAX ? yv : (xv + slope * yv) / (1 + slope * slope);
      for (int j = 0; j < cnt; ++j) {
        double key;
        if (slope == DBL_MAX)
          key = y[tt[j]];
        else
          key = (x[tt[j]] + slope * y[tt[j]]) / (1 + slope * slope);
        auto ite = mm.find({key});
        if (ite == mm.end())
          mm[(line){key}] = 1;
        else
          ite->second++;
      }
      bool ok = 1;
      cnt2 = 0;
      for (auto &ele : mm) tt2[cnt2++] = ele;
      if (cnt2 % 2 == 1) {
        int mid = (cnt2 - 1) / 2;
        if (!eq(tt2[mid].first.slope, midK)) ok = 0;
        if (ok) {
          for (int off = 1; off <= mid; ++off) {
            int l = mid - off, r = mid + off;
            if (!eq(abs(tt2[l].first.slope - midK),
                    abs(tt2[r].first.slope - midK)) ||
                tt2[l].second != tt2[r].second)
              ok = 0;
          }
        }
      } else {
        int l = (cnt2 - 1) / 2, r = l + 1;
        while (l >= 0) {
          if (!eq(abs(tt2[l].first.slope - midK),
                  abs(tt2[r].first.slope - midK)) ||
              tt2[l].second != tt2[r].second)
            ok = 0;
          --l, ++r;
        }
      }
      if (ok) {
        ss.insert({slope == DBL_MAX ? 11.11111111 : slope});
      }
    }
    printf("%d\n", ss.size());
  }
  return 0;
}

### Prompt

Please create a solution in cpp 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 MAX = 2010;
const double eps = 1e-9;
double x[MAX], y[MAX], xv, yv;
int n;
double key[MAX];
bool exist[MAX];
int tt[MAX], cnt, cnt2;
bool eq(double a, double b) { return abs(a - b) < eps; }
bool ls(double a, double b) { return a <= b - eps; }
bool gt(double a, double b) { return a >= b + eps; }
bool le(double a, double b) { return a < b + eps; }
bool ge(double a, double b) { return a > b - eps; }
struct line {
  double slope;
  line() {}
  line(double a) : slope(a) {}
  bool operator==(const line &b) const { return eq(slope, b.slope); }
  bool operator<(const line &b) const { return ls(slope, b.slope); }
};
pair<line, int> tt2[MAX];
inline double getK(const pair<double, double> &p1,
                   const pair<double, double> &p2) {
  if (p1.first == p2.first)
    return DBL_MAX;
  else
    return (p2.second - p1.second) / (p2.first - p1.first);
}
inline pair<double, double> medium(const pair<double, double> &p1,
                                   const pair<double, double> &p2) {
  return {(p1.first + p2.first) / 2, (p1.second + p2.second) / 2};
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%lf %lf", &x[i], &y[i]);
    xv += x[i], yv += y[i];
  }
  xv /= n, yv /= n;
  for (int i = 0; i < n; ++i) exist[i] = 1;
  for (int i = 0; i < n - 1; ++i) {
    if (exist[i] == 0) continue;
    for (int j = i + 1; j < n; ++j) {
      if (exist[j] == 0) continue;
      pair<double, double> mid = medium({x[i], y[i]}, {x[j], y[j]});
      if (eq(mid.first, xv) && eq(mid.second, yv)) exist[i] = exist[j] = 0;
    }
  }
  for (int i = 0; i < n; ++i)
    if (exist[i] == 1 && eq(x[i], xv) && eq(y[i], yv)) exist[i] = 0;
  for (int i = 0; i < n; ++i)
    if (exist[i] == 1) tt[cnt++] = i;
  if (cnt == 0)
    printf("%d\n", -1);
  else {
    set<line> ss;
    for (int i = 0; i < cnt; ++i) {
      pair<double, double> mid =
          medium({x[tt[0]], y[tt[0]]}, {x[tt[i]], y[tt[i]]});
      double slope =
          i ? getK(mid, {xv, yv}) : getK({x[tt[0]], y[tt[0]]}, {xv, yv});
      if (slope == 0)
        slope = DBL_MAX;
      else if (slope == DBL_MAX)
        slope = 0;
      else
        slope = -(1 / slope);
      map<line, int> mm;
      double midK =
          slope == DBL_MAX ? yv : (xv + slope * yv) / (1 + slope * slope);
      for (int j = 0; j < cnt; ++j) {
        double key;
        if (slope == DBL_MAX)
          key = y[tt[j]];
        else
          key = (x[tt[j]] + slope * y[tt[j]]) / (1 + slope * slope);
        auto ite = mm.find({key});
        if (ite == mm.end())
          mm[(line){key}] = 1;
        else
          ite->second++;
      }
      bool ok = 1;
      cnt2 = 0;
      for (auto &ele : mm) tt2[cnt2++] = ele;
      if (cnt2 % 2 == 1) {
        int mid = (cnt2 - 1) / 2;
        if (!eq(tt2[mid].first.slope, midK)) ok = 0;
        if (ok) {
          for (int off = 1; off <= mid; ++off) {
            int l = mid - off, r = mid + off;
            if (!eq(abs(tt2[l].first.slope - midK),
                    abs(tt2[r].first.slope - midK)) ||
                tt2[l].second != tt2[r].second)
              ok = 0;
          }
        }
      } else {
        int l = (cnt2 - 1) / 2, r = l + 1;
        while (l >= 0) {
          if (!eq(abs(tt2[l].first.slope - midK),
                  abs(tt2[r].first.slope - midK)) ||
              tt2[l].second != tt2[r].second)
            ok = 0;
          --l, ++r;
        }
      }
      if (ok) {
        ss.insert({slope == DBL_MAX ? 11.11111111 : slope});
      }
    }
    printf("%d\n", ss.size());
  }
  return 0;
}

```