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;
int n, rt = 0, ans = 0, cn;
long long b[2012];
bool vi[2012];
struct Po {
  long long x, y;
  inline Po operator+(const Po &b) const { return (Po){x + b.x, y + b.y}; }
  inline Po operator-(const Po &b) const { return (Po){x - b.x, y - b.y}; }
  inline Po operator/(const int &b) const { return (Po){x / b, y / b}; }
  inline bool operator==(const Po &b) const { return (x == b.x) && (y == b.y); }
  inline long long operator*(const Po &b) const { return (x * b.y - y * b.x); }
  inline Po re() {
    return ((x < 0) || ((x == 0) && (y < 0))) ? ((Po){-x, -y}) : (*this);
  }
} a[2012], c[2012], co;
inline bool cmp(Po x, Po y) { return ((x * y) > 0); }
inline bool can(Po x) {
  int i;
  for (i = 1; i <= n; i++) b[i] = (x - a[i]) * (co - a[i]);
  sort(b + 1, b + n + 1);
  for (i = 1; i <= n; i++)
    if ((b[i] + b[n - i + 1]) != 0) return false;
  return true;
}
int main() {
  scanf("%d", &n);
  int i, j;
  for (i = 1; i <= n; i++)
    scanf("%lld%lld", &a[i].x, &a[i].y), a[i].x *= (n << 1), a[i].y *= (n << 1),
        co = co + a[i];
  co = co / n;
  for (i = 1; i <= n; i++)
    for (j = i; j <= n; j++)
      if (((a[i] + a[j]) / 2) == co) vi[i] = vi[j] = 1;
  for (i = 1; i <= n; i++)
    if (!vi[i]) rt = i;
  if (!rt) {
    printf("-1");
    return 0;
  }
  for (i = 1; i <= n; i++)
    if (can((a[rt] + a[i]) / 2)) c[++cn] = (co - ((a[rt] + a[i]) / 2)).re();
  sort(c + 1, c + cn + 1, cmp);
  ans = (cn > 0);
  for (i = 2; i <= cn; i++) ans += (c[i - 1] * c[i]) != 0;
  printf("%d", ans);
  return 0;
}
