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 double eps = 1e-8;
const double pi = acos(-1);
inline int sgn(double x) {
  if (x < -eps)
    return -1;
  else if (x > eps)
    return 1;
  else
    return 0;
}
struct Point {
  double x, y;
  Point(double _x = 0.0, double _y = 0.0) : x(_x), y(_y) {}
  Point operator+(const Point &b) const { return Point(x + b.x, y + b.y); }
  Point operator-(const Point &b) const { return Point(x - b.x, y - b.y); }
  double operator*(const Point &b) const { return (x * b.x + y * b.y); }
  double operator^(const Point &b) const { return (x * b.y - y * b.x); }
  Point operator*(double b) { return Point(x * b, y * b); }
  bool operator<(const Point &b) const {
    if (sgn(x - b.x) == 0)
      return sgn(y - b.y) <= 0;
    else
      return sgn(x - b.x) < 0;
  }
  bool operator==(const Point &b) const {
    return sgn(x - b.x) == 0 && sgn(y - b.y) == 0;
  }
  Point rot(double ang) {
    return Point(x * cos(ang) - y * sin(ang), x * sin(ang) + y * cos(ang));
  }
  Point rot(double g1, double g2) {
    return Point(x * g2 - y * g1, x * g1 + y * g2);
  }
  double norm() { return sqrt(x * x + y * y); }
  Point unit() {
    double ll = norm();
    return Point(x / ll, y / ll);
  }
};
Point f[2005], p[2005];
bool vis[2005];
double d[2005];
int main() {
  int n, m, ans = 0, i, j;
  Point o = Point(0, 0);
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%lf%lf", &f[i].x, &f[i].y);
    o = o + f[i];
  }
  o = o * (1.0 / n);
  for (i = 0; i < n; i++) {
    if (vis[i]) continue;
    for (j = i; j < n; j++) {
      if (f[i] + f[j] == o * 2.0) {
        vis[i] = vis[j] = 1;
        break;
      }
    }
  }
  for (i = j = 0; i < n; i++) {
    if (!vis[i]) f[j++] = f[i] - o;
  }
  if (!j) return puts("-1"), 0;
  n = j;
  for (i = m = 0; i < n; i++) {
    Point u = f[0] + f[i];
    Point v = Point(-u.y, u.x);
    for (j = 0; j < n; j++) d[j] = f[j] * v;
    sort(d, d + n);
    for (j = 0; j < n; j++)
      if (sgn(d[j] + d[n - 1 - j])) break;
    if (j == n) {
      v = v.unit();
      for (j = 0; j < m; j++)
        if (!sgn(p[j] ^ v)) break;
      if (j == m) {
        ans++;
        p[m++] = v;
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}
