#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:167772160000")
using namespace std;
pair<long long, long long> totalSum;
pair<long long, long long> pts[2100];
int n;
long long answer;
set<pair<long long, long long> > tried;
long long gcd(long long a, long long b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
void tryVector(pair<long long, long long> a) {
  if (a.first == 0 && a.second == 0) return;
  if (a.first < 0 || (a.first == 0 && a.second < 0)) {
    a.first = -a.first;
    a.second = -a.second;
  }
  if (a.first == 0) a.second = 1;
  if (a.second == 0) a.first = 1;
  long long x = gcd(abs(a.first), abs(a.second));
  a.first /= x;
  a.second /= x;
  int prevSize = tried.size();
  tried.insert(a);
  if (tried.size() == prevSize) return;
  long long scalarSum = totalSum.first * a.first + totalSum.second * a.second;
  map<long long, long long> need;
  for (int i = 0; i < (n); i++) {
    long long curSc = n * (pts[i].first * a.first + pts[i].second * a.second);
    curSc -= scalarSum;
    if (curSc == 0) continue;
    int mult = 1;
    if (curSc < 0) {
      curSc = -curSc;
      mult = -1;
    }
    map<long long, long long>::iterator it = need.find(curSc);
    if (it != need.end()) {
      it->second += mult;
      if (it->second == 0) need.erase(it);
    } else
      need[curSc] += mult;
  }
  if (need.size() == 0) answer++;
}
pair<long long, long long> getSolution(pair<long long, long long> a,
                                       pair<long long, long long> b) {
  return pair<long long, long long>(b.second - a.second, a.first - b.first);
}
void solve() {
  if (n <= 2) {
    cout << -1;
    exit(0);
  }
  for (int i = 1; i < n; i++) {
    if (pair<long long, long long>(n * (pts[i].first + pts[0].first),
                                   n * (pts[i].second + pts[0].second)) ==
        pair<long long, long long>(totalSum.first * 2, totalSum.second * 2)) {
      totalSum.first -= (pts[i].first + pts[0].first);
      totalSum.second -= (pts[i].second + pts[0].second);
      pts[i] = pts[n - 1];
      n--;
      pts[0] = pts[n - 1];
      n--;
      solve();
      return;
    }
  }
  if (pair<long long, long long>(pts[0].first * n, pts[0].second * n) ==
      totalSum) {
    totalSum.first -= (pts[0].first);
    totalSum.second -= (pts[0].second);
    pts[0] = pts[n - 1];
    n--;
    solve();
    return;
  }
  for (int i = 0; i < (n); i++) {
    tryVector(getSolution(
        pair<long long, long long>(n * (pts[i].first + pts[0].first),
                                   n * (pts[i].second + pts[0].second)),
        pair<long long, long long>(2 * totalSum.first, 2 * totalSum.second)));
  }
  cout << answer;
  exit(0);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < (n); i++) {
    cin >> pts[i].first >> pts[i].second;
    totalSum.first += pts[i].first;
    totalSum.second += pts[i].second;
  }
  solve();
  return 0;
}

### Prompt

In cpp, your task is to solve 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>
#pragma comment(linker, "/STACK:167772160000")
using namespace std;
pair<long long, long long> totalSum;
pair<long long, long long> pts[2100];
int n;
long long answer;
set<pair<long long, long long> > tried;
long long gcd(long long a, long long b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
void tryVector(pair<long long, long long> a) {
  if (a.first == 0 && a.second == 0) return;
  if (a.first < 0 || (a.first == 0 && a.second < 0)) {
    a.first = -a.first;
    a.second = -a.second;
  }
  if (a.first == 0) a.second = 1;
  if (a.second == 0) a.first = 1;
  long long x = gcd(abs(a.first), abs(a.second));
  a.first /= x;
  a.second /= x;
  int prevSize = tried.size();
  tried.insert(a);
  if (tried.size() == prevSize) return;
  long long scalarSum = totalSum.first * a.first + totalSum.second * a.second;
  map<long long, long long> need;
  for (int i = 0; i < (n); i++) {
    long long curSc = n * (pts[i].first * a.first + pts[i].second * a.second);
    curSc -= scalarSum;
    if (curSc == 0) continue;
    int mult = 1;
    if (curSc < 0) {
      curSc = -curSc;
      mult = -1;
    }
    map<long long, long long>::iterator it = need.find(curSc);
    if (it != need.end()) {
      it->second += mult;
      if (it->second == 0) need.erase(it);
    } else
      need[curSc] += mult;
  }
  if (need.size() == 0) answer++;
}
pair<long long, long long> getSolution(pair<long long, long long> a,
                                       pair<long long, long long> b) {
  return pair<long long, long long>(b.second - a.second, a.first - b.first);
}
void solve() {
  if (n <= 2) {
    cout << -1;
    exit(0);
  }
  for (int i = 1; i < n; i++) {
    if (pair<long long, long long>(n * (pts[i].first + pts[0].first),
                                   n * (pts[i].second + pts[0].second)) ==
        pair<long long, long long>(totalSum.first * 2, totalSum.second * 2)) {
      totalSum.first -= (pts[i].first + pts[0].first);
      totalSum.second -= (pts[i].second + pts[0].second);
      pts[i] = pts[n - 1];
      n--;
      pts[0] = pts[n - 1];
      n--;
      solve();
      return;
    }
  }
  if (pair<long long, long long>(pts[0].first * n, pts[0].second * n) ==
      totalSum) {
    totalSum.first -= (pts[0].first);
    totalSum.second -= (pts[0].second);
    pts[0] = pts[n - 1];
    n--;
    solve();
    return;
  }
  for (int i = 0; i < (n); i++) {
    tryVector(getSolution(
        pair<long long, long long>(n * (pts[i].first + pts[0].first),
                                   n * (pts[i].second + pts[0].second)),
        pair<long long, long long>(2 * totalSum.first, 2 * totalSum.second)));
  }
  cout << answer;
  exit(0);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < (n); i++) {
    cin >> pts[i].first >> pts[i].second;
    totalSum.first += pts[i].first;
    totalSum.second += pts[i].second;
  }
  solve();
  return 0;
}

```