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;
const int MAXN = 2005;
struct cpoint {
  long long x, y;
};
long long cross_product(cpoint a, cpoint b) { return a.x * b.y - a.y * b.x; }
bool operator<(cpoint a, cpoint b) { return cross_product(a, b) < 0; }
int n, marked[MAXN], x[MAXN], y[MAXN];
int main() {
  scanf("%d", &n);
  long long sx = 0, sy = 0;
  for (int i = 0; i < n; i++) {
    scanf("%I64d %I64d", &x[i], &y[i]);
    sx += x[i];
    sy += y[i];
  }
  for (int i = 0; i < n; i++) {
    x[i] = x[i] * n - sx;
    y[i] = y[i] * n - sy;
    if (x[i] == 0 && y[i] == 0) marked[i] = 1;
  }
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++) {
      if (x[i] == -x[j] && y[i] == -y[j]) {
        marked[i] = 1;
        marked[j] = 1;
      }
    }
  int m = 0;
  for (int i = 0; i < n; i++)
    if (marked[i] == 0) m++;
  if (m == 0)
    printf("-1\n");
  else {
    vector<cpoint> v;
    for (int i = 0; i < n; i++)
      if (marked[i] == 0)
        for (int j = i; j < n; j++)
          if (marked[j] == 0) {
            long long xi = x[i] + x[j];
            long long yi = y[i] + y[j];
            if (yi < 0) {
              xi = -xi;
              yi = -yi;
            }
            if (xi == 0) {
              v.push_back({1, 0});
            } else if (yi == 0) {
              v.push_back({0, 1});
            } else {
              v.push_back({yi, -xi});
            }
          }
    sort(v.begin(), v.end());
    int res = 0;
    for (int i = 0; i < (int)v.size();) {
      int j = i;
      while (j < (int)v.size() && cross_product(v[i], v[j]) == 0) j++;
      if (j - i + 1 >= m / 2) {
        vector<long long> f;
        for (int k = 0; k < n; k++) {
          long long c = v[i].x * x[k] + v[i].y * y[k];
          f.push_back(c);
        }
        sort(f.begin(), f.end());
        bool ok = true;
        for (int i = 0; i < (int)f.size(); i++)
          if (f[i] != -f[((int)f.size()) - i - 1]) ok = false;
        if (ok) res++;
      }
      i = j;
    }
    printf("%d\n", res);
  }
  return 0;
}
