#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  return x * f;
}
struct Point {
  long long x, y;
  inline Point(long long x = 0, long long y = 0) : x(x), y(y) {}
  inline friend long long operator==(const Point a, const Point b) {
    return a.x == b.x && a.y == b.y;
  }
  inline friend Point operator-(const Point a, const Point b) {
    return Point(a.x - b.x, a.y - b.y);
  }
} a[2010], b[2010];
struct Line {
  Point x, y;
  inline Line(Point x, Point y) : x(x), y(y) {}
};
long long vis[2010];
inline long long gcd(long long x, long long y) { return y ? gcd(y, x % y) : x; }
inline long long Symmetry(Point a, Point b, Point c) {
  return c.x * 2 == a.x + b.x && c.y * 2 == a.y + b.y;
}
map<pair<long long, long long>, long long> Map;
long long Cos[2010];
inline long long check(long long n) {
  long long l = 1, r = n;
  while (l <= r && Cos[l] == -Cos[r]) l++, r--;
  return l > r;
}
signed main() {
  long long _ = read(), n = 0, ans = 0;
  Point G;
  for (long long i = 1; i <= _; i++) {
    b[i].x = 1LL * read() * _, b[i].y = 1LL * read() * _;
    G.x += b[i].x / _, G.y += b[i].y / _;
  }
  for (long long i = 1; i <= _; i++) {
    if (b[i] == G) {
      vis[i] = true;
      continue;
    }
    for (long long j = 1; j <= _; j++)
      if (i != j && Symmetry(b[i], b[j], G)) vis[i] = true, vis[j] = true;
  }
  for (long long i = 1; i <= _; i++)
    if (!vis[i]) a[++n] = b[i];
  if (n <= 2) return puts("-1"), 0;
  for (long long i = 1; i <= n; i++) a[i] = a[i] - G;
  for (long long i = 1; i <= n; i++) {
    long long tmpx = a[1].x + a[i].x;
    long long tmpy = a[1].y + a[i].y;
    long long g = gcd(tmpx, tmpy);
    tmpx /= g, tmpy /= g;
    if (Map.find(make_pair(tmpx, tmpy)) != Map.end()) continue;
    for (long long j = 1; j <= n; j++) Cos[j] = -tmpy * a[j].x + tmpx * a[j].y;
    sort(Cos + 1, Cos + n + 1);
    if (check(n)) ++ans, Map[make_pair(tmpx, tmpy)] = true;
  }
  cout << ans << endl;
  return 0;
}

### Prompt

Please formulate a CPP solution 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;
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  return x * f;
}
struct Point {
  long long x, y;
  inline Point(long long x = 0, long long y = 0) : x(x), y(y) {}
  inline friend long long operator==(const Point a, const Point b) {
    return a.x == b.x && a.y == b.y;
  }
  inline friend Point operator-(const Point a, const Point b) {
    return Point(a.x - b.x, a.y - b.y);
  }
} a[2010], b[2010];
struct Line {
  Point x, y;
  inline Line(Point x, Point y) : x(x), y(y) {}
};
long long vis[2010];
inline long long gcd(long long x, long long y) { return y ? gcd(y, x % y) : x; }
inline long long Symmetry(Point a, Point b, Point c) {
  return c.x * 2 == a.x + b.x && c.y * 2 == a.y + b.y;
}
map<pair<long long, long long>, long long> Map;
long long Cos[2010];
inline long long check(long long n) {
  long long l = 1, r = n;
  while (l <= r && Cos[l] == -Cos[r]) l++, r--;
  return l > r;
}
signed main() {
  long long _ = read(), n = 0, ans = 0;
  Point G;
  for (long long i = 1; i <= _; i++) {
    b[i].x = 1LL * read() * _, b[i].y = 1LL * read() * _;
    G.x += b[i].x / _, G.y += b[i].y / _;
  }
  for (long long i = 1; i <= _; i++) {
    if (b[i] == G) {
      vis[i] = true;
      continue;
    }
    for (long long j = 1; j <= _; j++)
      if (i != j && Symmetry(b[i], b[j], G)) vis[i] = true, vis[j] = true;
  }
  for (long long i = 1; i <= _; i++)
    if (!vis[i]) a[++n] = b[i];
  if (n <= 2) return puts("-1"), 0;
  for (long long i = 1; i <= n; i++) a[i] = a[i] - G;
  for (long long i = 1; i <= n; i++) {
    long long tmpx = a[1].x + a[i].x;
    long long tmpy = a[1].y + a[i].y;
    long long g = gcd(tmpx, tmpy);
    tmpx /= g, tmpy /= g;
    if (Map.find(make_pair(tmpx, tmpy)) != Map.end()) continue;
    for (long long j = 1; j <= n; j++) Cos[j] = -tmpy * a[j].x + tmpx * a[j].y;
    sort(Cos + 1, Cos + n + 1);
    if (check(n)) ++ans, Map[make_pair(tmpx, tmpy)] = true;
  }
  cout << ans << endl;
  return 0;
}

```