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.
#include <bits/stdc++.h>
using namespace std;
vector<string> split(const string& s, char c) {
  vector<string> v;
  stringstream ss(s);
  string x;
  while (getline(ss, x, c)) v.push_back(move(x));
  return v;
}
void err(vector<string>::iterator it) {}
template <typename T, typename... Args>
void err(vector<string>::iterator it, T a, Args... args) {
  cerr << it->substr((*it)[0] == ' ', it->length()) << " = " << a << '\n';
  err(++it, args...);
}
const double eps = 1e-10;
int N;
complex<double> P[2013];
complex<double> M;
bool bad[2013];
bool cancel[2013];
bool coincide(complex<double> p1, complex<double> p2) {
  return abs(p1 - p2) < eps;
}
double cross(complex<double> v1, complex<double> v2) {
  return imag(conj(v1) * v2);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> N;
  for (int i = 0; i < N; i++) {
    double x, y;
    cin >> x >> y;
    P[i] = complex<double>(x, y);
    M += P[i];
  }
  M /= N;
  for (int i = 0; i < N; i++) {
    P[i] -= M;
  }
  complex<double> p;
  bool found = false;
  for (int i = 0; i < N; i++) {
    p = P[i];
    bool ok = true;
    for (int j = 0; j < N; j++) {
      if (coincide(P[j], -p)) {
        ok = false;
        break;
      }
    }
    if (ok) {
      found = true;
      break;
    }
  }
  if (!found) {
    cout << -1 << endl;
    return 0;
  }
  vector<complex<double> > ans;
  for (int j = 0; j < N; j++) {
    complex<double> q = P[j];
    complex<double> mid = (p + q) / 2.0;
    vector<double> pos;
    for (int i = 0; i < N; i++) {
      pos.push_back(cross(P[i], mid));
    }
    sort(pos.begin(), pos.end());
    bool ok = true;
    for (int s = 0, e = N - 1; s <= e && ok; s++, e--) {
      ok = coincide(pos[s], -pos[e]);
    }
    if (ok) {
      ans.push_back(mid);
    }
  }
  int res = 0;
  for (int i = 0; i < ans.size(); i++) {
    bool ok = true;
    for (int j = 0; j < i; j++) {
      if (coincide(cross(ans[j], ans[i]), 0)) {
        ok = false;
        break;
      }
    }
    res += ok;
  }
  cout << res << endl;
  return 0;
}
