#include <bits/stdc++.h>
using namespace std;
const long long N = 2007;
int n, x, ans = 0, id[N];
class Node {
 public:
  double x, y;
  Node(double a = 0, double b = 0) : x(a), y(b) {}
  Node operator+(const Node& b) const { return Node(x + b.x, y + b.y); }
  Node operator-(const Node& b) const { return Node(x - b.x, y - b.y); }
  double operator*(const Node& b) const { return x * b.x + y * b.y; }
  Node operator/(double b) const { return Node(x / b, y / b); }
  bool operator==(const Node& b) const {
    return fabs(x - b.x) < 1e-9 && fabs(y - b.y) < 1e-9;
  }
} p[N], root, mid, vec;
pair<double, int> a[N];
template <typename T>
inline T read(T& x = 0) {
  bool f = 0;
  char c;
  for (; !isdigit(c = getchar()); f |= (c == '-'))
    ;
  for (x = 0; isdigit(c); c = getchar()) x = (x << 3) + (x << 1) + (c ^ 48);
  return x = (f ? -x : x);
}
template <typename T, typename... Args>
inline void read(T& a, Args&... args) {
  read(a);
  read(args...);
}
template <typename T>
inline void print(T x) {
  if (x > 9) print(x / 10);
  putchar(x % 10 + '0');
}
bool check(int pos) {
  mid = (p[x] + p[pos]) / 2, vec = mid - root;
  vec = Node(vec.y, -vec.x);
  for (register int i = (1); i <= (n); i++) a[i] = make_pair(vec * p[i], i);
  sort(a + 1, a + 1 + n);
  for (register int i = (1); i <= (n); i++) id[a[i].second] = i;
  if (id[x] + id[pos] != n + 1) return 0;
  double cmp = a[1].first + a[n].first;
  for (register int i = (1); i <= (n); i++)
    if (fabs(a[i].first + a[n - i + 1].first - cmp) > 1e-9) return 0;
  return 1;
}
int main() {
  int a, b;
  root = mid = vec = Node(0, 0);
  ans = 0;
  read(n);
  for (register int i = (1); i <= (n); i++)
    read(a, b), p[i] = Node(a, b), root = root + p[i];
  root = root / n;
  for (register int i = (1); i <= (n); i++) {
    bool f = 0;
    for (register int j = (1); j <= (n); j++)
      if (p[i] + p[j] == root + root) f = 1;
    if (!f) x = i;
  }
  if (!x) return puts("-1"), 0;
  for (register int i = (1); i <= (n); i++)
    if (check(i)) ++ans;
  print(ans);
  return 0;
}

### Prompt

Generate 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;
const long long N = 2007;
int n, x, ans = 0, id[N];
class Node {
 public:
  double x, y;
  Node(double a = 0, double b = 0) : x(a), y(b) {}
  Node operator+(const Node& b) const { return Node(x + b.x, y + b.y); }
  Node operator-(const Node& b) const { return Node(x - b.x, y - b.y); }
  double operator*(const Node& b) const { return x * b.x + y * b.y; }
  Node operator/(double b) const { return Node(x / b, y / b); }
  bool operator==(const Node& b) const {
    return fabs(x - b.x) < 1e-9 && fabs(y - b.y) < 1e-9;
  }
} p[N], root, mid, vec;
pair<double, int> a[N];
template <typename T>
inline T read(T& x = 0) {
  bool f = 0;
  char c;
  for (; !isdigit(c = getchar()); f |= (c == '-'))
    ;
  for (x = 0; isdigit(c); c = getchar()) x = (x << 3) + (x << 1) + (c ^ 48);
  return x = (f ? -x : x);
}
template <typename T, typename... Args>
inline void read(T& a, Args&... args) {
  read(a);
  read(args...);
}
template <typename T>
inline void print(T x) {
  if (x > 9) print(x / 10);
  putchar(x % 10 + '0');
}
bool check(int pos) {
  mid = (p[x] + p[pos]) / 2, vec = mid - root;
  vec = Node(vec.y, -vec.x);
  for (register int i = (1); i <= (n); i++) a[i] = make_pair(vec * p[i], i);
  sort(a + 1, a + 1 + n);
  for (register int i = (1); i <= (n); i++) id[a[i].second] = i;
  if (id[x] + id[pos] != n + 1) return 0;
  double cmp = a[1].first + a[n].first;
  for (register int i = (1); i <= (n); i++)
    if (fabs(a[i].first + a[n - i + 1].first - cmp) > 1e-9) return 0;
  return 1;
}
int main() {
  int a, b;
  root = mid = vec = Node(0, 0);
  ans = 0;
  read(n);
  for (register int i = (1); i <= (n); i++)
    read(a, b), p[i] = Node(a, b), root = root + p[i];
  root = root / n;
  for (register int i = (1); i <= (n); i++) {
    bool f = 0;
    for (register int j = (1); j <= (n); j++)
      if (p[i] + p[j] == root + root) f = 1;
    if (!f) x = i;
  }
  if (!x) return puts("-1"), 0;
  for (register int i = (1); i <= (n); i++)
    if (check(i)) ++ans;
  print(ans);
  return 0;
}

```