#include <bits/stdc++.h>
using namespace std;
inline double Abs(double x) { return x > 0 ? x : -x; }
const int N = 2005;
struct Point {
  double x, y;
  Point operator+(Point a) { return (Point){x + a.x, y + a.y}; }
  Point operator-(Point a) { return (Point){x - a.x, y - a.y}; }
  double operator*(Point a) { return x * a.x + y * a.y; }
  Point operator/(double a) { return (Point){x / a, y / a}; }
  bool operator==(Point a) {
    return Abs(a.x - x) < 1e-9 && Abs(a.y - y) < 1e-9;
  }
} a[N], mid;
int x, to[N];
bool tag[N];
pair<double, int> p[N];
int n;
inline bool check(int id) {
  Point md = (a[x] + a[id]) / 2;
  Point vec = mid - md;
  vec = (Point){vec.y, -vec.x};
  for (int i = 1; i <= n; i++) p[i] = make_pair(vec * a[i], i);
  sort(p + 1, p + n + 1);
  for (int i = 1; i <= n; i++) to[p[i].second] = i;
  if (to[id] + to[x] != n + 1) return false;
  double flag = p[1].first + p[n].first;
  for (int i = 1; i <= n; i++)
    if (Abs(p[i].first + p[n - i + 1].first - flag) > 1e-9) return false;
  return true;
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i].x >> a[i].y;
    mid = mid + a[i];
  }
  mid = mid / n;
  bool inf = true;
  for (int i = 1; i <= n; i++) {
    bool flag = false;
    for (int j = 1; j <= n; j++)
      if (a[i] + a[j] == mid + mid) flag = true;
    if (!flag) inf = false, x = i;
  }
  if (inf) {
    puts("-1");
    return 0;
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) ans += check(i);
  printf("%d", 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;
inline double Abs(double x) { return x > 0 ? x : -x; }
const int N = 2005;
struct Point {
  double x, y;
  Point operator+(Point a) { return (Point){x + a.x, y + a.y}; }
  Point operator-(Point a) { return (Point){x - a.x, y - a.y}; }
  double operator*(Point a) { return x * a.x + y * a.y; }
  Point operator/(double a) { return (Point){x / a, y / a}; }
  bool operator==(Point a) {
    return Abs(a.x - x) < 1e-9 && Abs(a.y - y) < 1e-9;
  }
} a[N], mid;
int x, to[N];
bool tag[N];
pair<double, int> p[N];
int n;
inline bool check(int id) {
  Point md = (a[x] + a[id]) / 2;
  Point vec = mid - md;
  vec = (Point){vec.y, -vec.x};
  for (int i = 1; i <= n; i++) p[i] = make_pair(vec * a[i], i);
  sort(p + 1, p + n + 1);
  for (int i = 1; i <= n; i++) to[p[i].second] = i;
  if (to[id] + to[x] != n + 1) return false;
  double flag = p[1].first + p[n].first;
  for (int i = 1; i <= n; i++)
    if (Abs(p[i].first + p[n - i + 1].first - flag) > 1e-9) return false;
  return true;
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i].x >> a[i].y;
    mid = mid + a[i];
  }
  mid = mid / n;
  bool inf = true;
  for (int i = 1; i <= n; i++) {
    bool flag = false;
    for (int j = 1; j <= n; j++)
      if (a[i] + a[j] == mid + mid) flag = true;
    if (!flag) inf = false, x = i;
  }
  if (inf) {
    puts("-1");
    return 0;
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) ans += check(i);
  printf("%d", ans);
  return 0;
}

```