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 point {
  double x, y;
  void scan() { scanf("%lf%lf", &x, &y); }
  point() {}
  point(double x, double y) : x(x), y(y) {}
  point operator+(const point& p) const { return point(x + p.x, y + p.y); }
  point operator-(const point& p) const { return point(x - p.x, y - p.y); }
  point operator*(const double d) const { return point(x * d, y * d); }
  int operator==(const point& p) const {
    return fabs(p.x - x) < 1e-9 && fabs(p.y - y) < 1e-9;
  }
} p[2100], S, anses[2100];
double cross(point A, point B) { return A.x * B.y - B.x * A.y; }
double dot(point A, point B) { return A.x * B.x + A.y * B.y; }
int n, tp, tg[2100];
double ls[2100];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) p[i].scan(), S = S + p[i];
  for (int i = 1; i <= n; ++i)
    if (!tg[i])
      for (int j = i; j <= n; ++j)
        if (!tg[j] && S * 2 == (p[i] + p[j]) * n) tg[i] = tg[j] = 1;
  S = S * (1 / (double)n);
  for (int i = 1; i <= n; ++i)
    if (!tg[i]) p[++tp] = p[i];
  n = tp, tp = 0;
  if (!n) return puts("-1"), 0;
  for (int i = 1; i <= n; ++i) p[i] = p[i] - S;
  for (int i = 1; i <= n; ++i) {
    point x = p[1] + p[i], y(-x.y, x.x);
    for (int j = 1; j <= n; ++j) ls[j] = dot(p[j], y);
    sort(ls + 1, ls + n + 1);
    for (int j = 1; j <= n + 1 - j; j++)
      if (fabs((ls[j] + ls[n + 1 - j]) / 2) > 1e-9) goto nxt;
    anses[++tp] = y;
  nxt:;
  }
  int sum = 0;
  for (int i = 1; i <= tp; ++i) {
    for (int j = 1; j < i; ++j)
      if (fabs(cross(anses[i], anses[j])) < 1e-9) goto nxt2;
    sum++;
  nxt2:;
  }
  printf("%d", sum);
}
