#include <bits/stdc++.h>
using namespace std;
namespace VECTOR {
short sgn(double x) { return x < -1e-8 ? -1 : x > 1e-8; }
struct point {
  double x, y;
  point() {}
  point(double X, double Y) : x(X), y(Y) {}
  const point operator+(const point& q) const {
    return point(x + q.x, y + q.y);
  }
  const point operator-(const point& q) const {
    return point(x - q.x, y - q.y);
  }
  const point operator*(double q) const { return point(x * q, y * q); }
  const point operator/(double q) const { return point(x / q, y / q); }
  bool operator==(const point& q) const {
    return sgn(x - q.x) == 0 && sgn(y - q.y) == 0;
  }
  double length() const { return sqrt(x * x + y * y); }
  const point unit() const {
    double len = length();
    return point(x / len, y / len);
  }
  const point upright() const { return point(-y, x).unit(); }
};
double dot(const point& s, const point& t) { return s.x * t.x + s.y * t.y; }
double cross(const point& s, const point& t) { return s.x * t.y - t.x * s.y; }
const point getG(point p[], int n) {
  point ret;
  for (int i = 1; i <= n; i++) {
    ret = ret + p[i];
  }
  return ret / n;
}
}  // namespace VECTOR
using namespace VECTOR;
int n, A, pos[2002];
pair<double, int> b[2002];
point p[2002], G;
bool checkIfNot() {
  bool flag = 1;
  for (int i = 1; i <= n; i++) {
    bool flag1 = 0;
    for (int j = 1; j <= n; j++) {
      if (p[i] + p[j] == G + G) {
        flag1 = 1;
      }
    }
    if (!flag1) {
      flag = 0;
      A = i;
    }
  }
  if (flag) {
    puts("-1");
    return 1;
  }
  return 0;
}
bool solve(int B) {
  point u = ((p[A] + p[B]) / 2 - G).upright();
  for (int i = 1; i <= n; i++) {
    b[i] = pair<double, int>(dot(u, p[i]), i);
  }
  sort(b + 1, b + n + 1);
  for (int i = 1; i <= n; i++) {
    pos[b[i].second] = i;
  }
  if (pos[A] + pos[B] != n + 1) return 0;
  double tmp = b[1].first + b[n].first;
  for (int i = 2; i <= (n >> 1); i++) {
    if (sgn(b[i].first + b[n - i + 1].first - tmp) != 0) return 0;
  }
  return 1;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%lf%lf", &p[i].x, &p[i].y);
  }
  G = getG(p, n);
  if (checkIfNot()) return 0;
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    if (solve(i)) ans++;
  }
  printf("%d\n", ans);
  return 0;
}

### Prompt

Create a solution in CPP for 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;
namespace VECTOR {
short sgn(double x) { return x < -1e-8 ? -1 : x > 1e-8; }
struct point {
  double x, y;
  point() {}
  point(double X, double Y) : x(X), y(Y) {}
  const point operator+(const point& q) const {
    return point(x + q.x, y + q.y);
  }
  const point operator-(const point& q) const {
    return point(x - q.x, y - q.y);
  }
  const point operator*(double q) const { return point(x * q, y * q); }
  const point operator/(double q) const { return point(x / q, y / q); }
  bool operator==(const point& q) const {
    return sgn(x - q.x) == 0 && sgn(y - q.y) == 0;
  }
  double length() const { return sqrt(x * x + y * y); }
  const point unit() const {
    double len = length();
    return point(x / len, y / len);
  }
  const point upright() const { return point(-y, x).unit(); }
};
double dot(const point& s, const point& t) { return s.x * t.x + s.y * t.y; }
double cross(const point& s, const point& t) { return s.x * t.y - t.x * s.y; }
const point getG(point p[], int n) {
  point ret;
  for (int i = 1; i <= n; i++) {
    ret = ret + p[i];
  }
  return ret / n;
}
}  // namespace VECTOR
using namespace VECTOR;
int n, A, pos[2002];
pair<double, int> b[2002];
point p[2002], G;
bool checkIfNot() {
  bool flag = 1;
  for (int i = 1; i <= n; i++) {
    bool flag1 = 0;
    for (int j = 1; j <= n; j++) {
      if (p[i] + p[j] == G + G) {
        flag1 = 1;
      }
    }
    if (!flag1) {
      flag = 0;
      A = i;
    }
  }
  if (flag) {
    puts("-1");
    return 1;
  }
  return 0;
}
bool solve(int B) {
  point u = ((p[A] + p[B]) / 2 - G).upright();
  for (int i = 1; i <= n; i++) {
    b[i] = pair<double, int>(dot(u, p[i]), i);
  }
  sort(b + 1, b + n + 1);
  for (int i = 1; i <= n; i++) {
    pos[b[i].second] = i;
  }
  if (pos[A] + pos[B] != n + 1) return 0;
  double tmp = b[1].first + b[n].first;
  for (int i = 2; i <= (n >> 1); i++) {
    if (sgn(b[i].first + b[n - i + 1].first - tmp) != 0) return 0;
  }
  return 1;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%lf%lf", &p[i].x, &p[i].y);
  }
  G = getG(p, n);
  if (checkIfNot()) return 0;
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    if (solve(i)) ans++;
  }
  printf("%d\n", ans);
  return 0;
}

```