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;
struct rua {
  long double x, y;
} m;
set<pair<long double, long double> > p;
vector<pair<long double, long double> > del;
vector<long double> d;
set<long double> mm;
int n, ans;
long double x, y;
bool tt;
bool check(rua T) {
  d.clear();
  rua M = {(T.x + x) / 2, (T.y + y) / 2};
  rua mM = {M.x - m.x, M.y - m.y}, r0 = {mM.y, -mM.x};
  if (!r0.x)
    if (tt)
      return false;
    else
      tt = true;
  long double k = r0.y / r0.x, R = pow(r0.x * r0.x + r0.y * r0.y, 0.5);
  if (mm.count(k))
    return false;
  else
    mm.insert(k);
  for (auto i = p.begin(); i != p.end(); i++) {
    rua mP = {(*i).first - m.x, (*i).second - m.y};
    long double t = r0.x * mP.x + r0.y * mP.y;
    t /= r0.x * r0.x + r0.y * r0.y;
    if (t) d.push_back(t);
  }
  long double _ = (r0.x * mM.x + r0.y * mM.y) / R;
  int l = 0, r = d.size() - 1;
  sort(d.begin(), d.end());
  while (l <= r && d[l] + d[r] == 0) l++, r--;
  return l > r;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    cin >> x >> y;
    p.insert(make_pair(x, y));
    m.x += x, m.y += y;
  }
  m.x = m.x * 1.0 / n, m.y = m.y * 1.0 / n;
  for (auto i = p.begin(); i != p.end(); i++) {
    x = (*i).first, y = (*i).second;
    if (p.count(make_pair(2 * m.x - x, 2 * m.y - y)))
      del.push_back(make_pair(2 * m.x - x, 2 * m.y - y)), del.push_back(*i);
  }
  for (int i = 0; i < del.size(); i++)
    if (p.count(del[i])) p.erase(del[i]);
  if (!p.size()) return printf("-1\n"), 0;
  x = (*p.begin()).first, y = (*p.begin()).second;
  for (auto i = p.begin(); i != p.end(); i++)
    if (check({(*i).first, (*i).second})) ans++;
  return printf("%d\n", ans), 0;
}
