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;
double prodvec(complex<double> p1, complex<double> p2) {
  return imag(conj(p1) * p2);
}
complex<double> leer() {
  double x, y;
  cin >> x >> y;
  return complex<double>(x, y);
}
double error = 1e-10;
bool coincide(double x1, double x2) { return abs(x1 - x2) < error; }
bool coincide(complex<double> p1, complex<double> p2) {
  return abs(p1 - p2) < error;
}
bool compara(complex<double> p1, complex<double> p2) {
  if (real(p1) != real(p2)) return real(p1) < real(p2);
  return imag(p1) < imag(p2);
}
int n;
complex<double> vp[2005];
complex<double> c;
complex<double> get() {
  for (int i = 0; i < n; i++) {
    complex<double> q = c + (c - vp[i]);
    bool found = false;
    for (int j = 0; j < n and not found; j++) found = coincide(q, vp[j]);
    if (not found) return vp[i];
  }
  cout << -1 << endl;
  exit(0);
  return complex<double>(0, 0);
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) vp[i] = leer();
  c = complex<double>(0, 0);
  for (int i = 0; i < n; i++) c += vp[i];
  c /= n;
  complex<double> p = get();
  vector<complex<double> > vsol;
  for (int cas = 0; cas < n; cas++) {
    complex<double> q = vp[cas];
    complex<double> med = (p + q) / 2.0;
    complex<double> v = med - c;
    vector<double> vd(n);
    for (int j = 0; j < n; j++) vd[j] = prodvec(v, vp[j] - c);
    sort(vd.begin(), vd.end());
    bool ok = true;
    for (int i = 0, j = n - 1; i <= j and ok; i++, j--)
      ok = coincide(vd[i], -vd[j]);
    if (ok) vsol.push_back(v);
  }
  int sol = 0;
  for (int i = 0; i < int(vsol.size()); i++) {
    bool ok = true;
    for (int j = 0; j < i and ok; j++)
      ok = abs(prodvec(vsol[i], vsol[j])) > error;
    sol += ok;
  }
  cout << sol << endl;
}
