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 long long MOD = 1e9 + 7;
const int MSIZE = 5e5;
const long long base = 7;
const double EPS = 1e-9;
const int INF = 1e9;
struct point {
  double x, y;
  point() : x(0), y(0){};
  point(double x, double y) : x(x), y(y){};
  point operator+(point a) { return point(x + a.x, y + a.y); }
  point operator-(point a) { return point(x - a.x, y - a.y); }
  point operator*(double d) { return point(x * d, y * d); }
  point operator/(double d) { return point(x / d, y / d); }
  bool operator==(point a) {
    return abs(x - a.x) <= EPS && abs(y - a.y) <= EPS;
  }
  bool operator!=(point a) { return abs(x - a.x) > EPS || abs(y - a.y) > EPS; }
  point normal() {
    point p(x, y);
    return p / sqrt(x * x + y * y);
  }
};
struct line {
  double a, b, c;
  line() : a(0), b(0), c(0){};
  line(point _a, point _b) {
    a = _a.y - _b.y;
    b = _b.x - _a.x;
    c = _a.x * _b.y - _a.y * _b.x;
  }
};
double dist(line l, point p) {
  return (l.a * p.x + l.b * p.y + l.c) / sqrt(l.a * l.a + l.b * l.b);
}
point project(line l, point p) {
  point a = point(-l.a, -l.b).normal();
  double d = dist(l, p);
  return p + a * d;
}
bool cmp(point a, point b) {
  return abs(a.x - b.x) <= EPS ? a.y < b.y : a.x < b.x;
}
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<point> v(n);
  point mid;
  for (int i = 0; i < n; ++i) {
    cin >> v[i].x >> v[i].y;
    mid.x += v[i].x, mid.y += v[i].y;
  }
  mid.x /= n, mid.y /= n;
  vector<char> used(n, 1);
  int cnt = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = i; j < n; ++j) {
      if (!used[i] || !used[j]) continue;
      if ((mid - v[i]) == (v[j] - mid)) {
        used[i] = used[j] = 0;
        cnt++;
        if (i != j) cnt++;
      }
    }
  }
  if (cnt == n) {
    cout << -1;
    return 0;
  }
  int res = 0;
  int start = 0;
  for (int i = 0; i < n; ++i)
    if (used[i]) {
      start = i;
      break;
    }
  vector<line> out;
  for (int i = start; i < n; ++i) {
    point tmid = (v[start] + v[i]) / 2;
    line l(mid, tmid);
    l = line(point(0, 0), point(l.a, l.b));
    vector<point> tv;
    for (int j = 0; j < n; ++j)
      if (used[j]) tv.push_back(project(l, v[j]));
    sort(tv.begin(), tv.end(), cmp);
    bool flag = 1;
    tmid = tv[0] + ((tv.back() - tv[0]) / 2);
    for (int j = 0; j < tv.size(); ++j)
      if (tmid - tv[j] != tv[int(tv.size()) - j - 1] - tmid) {
        flag = 0;
        break;
      }
    if (flag) {
      out.push_back(l);
    }
  }
  vector<char> usedl(out.size(), 1);
  for (int i = 0; i < out.size(); ++i)
    for (int j = i + 1; j < out.size(); ++j)
      if (abs(dist(out[i], point(-out[j].b, out[j].a))) <= EPS) usedl[j] = 0;
  for (char a : usedl) res += a;
  cout << res;
  return 0;
}
