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;
long long o_x, o_y, x[2100], y[2100], t[2100];
map<pair<long long, long long>, bool> mp;
inline int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
bool check(int a, int b) {
  long long mid_x = (x[a] + x[b]), mid_y = (y[a] + y[b]);
  long long g = gcd(mid_x, mid_y);
  mid_x /= g;
  mid_y /= g;
  if (mp[pair<long long, long long>(mid_x, mid_y)]) return false;
  int cnt = 0;
  for (int i = 1; i <= n; i++)
    if (x[i] || y[i]) cnt++, t[cnt] = mid_x * y[i] - mid_y * x[i];
  sort(t + 1, t + cnt + 1);
  for (int i = 1; i <= cnt; i++)
    if (t[i] + t[cnt - i + 1]) return false;
  mp[pair<long long, long long>(mid_x, mid_y)] = true;
  return true;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%lld%lld", &x[i], &y[i]);
    o_x += x[i];
    o_y += y[i];
    x[i] *= n;
    y[i] *= n;
  }
  int a = 0;
  for (int i = 1; i <= n; i++) x[i] -= o_x, y[i] -= o_y;
  bool flag;
  for (int i = 1; i <= n; i++) {
    flag = false;
    for (int j = 1; j <= n; j++)
      if (x[i] + x[j] == 0 && y[i] + y[j] == 0) {
        flag = true;
        break;
      }
    if (!flag && !a) a = i;
  }
  if (!a) {
    puts("-1");
    return 0;
  }
  int ans = 0;
  for (int i = 1; i <= n; i++)
    if (check(a, i)) ans++;
  printf("%d\n", ans);
  return 0;
}
