#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long double EPS = 1e-11;
const long long INFL = 1e16;
const int INF = 2e9 + 7;
mt19937 rnd((unsigned)chrono::steady_clock::now().time_since_epoch().count());
long long gcd(long long a, long long b) {
  if (a == 0 || b == 0) {
    return a + b;
  }
  return gcd(b, a % b);
}
pair<long long, long long> test(long long cx, long long cy, vector<long long> x,
                                vector<long long> y, long long sx, long long sy,
                                long long n) {
  sx -= n * cx;
  sy -= n * cy;
  for (int i = 0; i < n; ++i) {
    x[i] -= cx;
    y[i] -= cy;
  }
  long long a = 0 - sy, b = sx;
  if (a < 0 || a == 0 && b < 0) {
    a *= -1;
    b *= -1;
  }
  vector<long long> c(n);
  for (int i = 0; i < n; ++i) {
    c[i] = a * x[i] + b * y[i];
  }
  sort(c.begin(), c.end());
  for (int i = 0; i < n; ++i) {
    if (c[i] != 0 - c[n - i - 1]) {
      return {0, 0};
    }
  }
  return {a / gcd(a, b), b / gcd(a, b)};
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  long long n;
  cin >> n;
  vector<long long> x(n), y(n);
  long long sx = 0, sy = 0;
  for (int i = 0; i < n; ++i) {
    cin >> x[i] >> y[i];
    ;
    x[i] *= 2;
    y[i] *= 2;
    sx += x[i];
    sy += y[i];
  }
  for (int i = 0; i < n; ++i) {
    if (sx == x[i] * n && sy == y[i] * n) {
      sx -= x[i];
      sy -= y[i];
      --n;
      x.erase(x.begin() + i);
      y.erase(y.begin() + i);
      --i;
    }
  }
  for (int i = 0; i < n; ++i) {
    for (int j = i + 1; j < n; ++j) {
      if ((x[i] + x[j]) * n == sx * 2LL && (y[i] + y[j]) * n == sy * 2LL) {
        sx -= x[i] + x[j];
        sy -= y[i] + y[j];
        n -= 2;
        x.erase(x.begin() + j);
        x.erase(x.begin() + i);
        y.erase(y.begin() + j);
        y.erase(y.begin() + i);
        --i;
        break;
      }
    }
  }
  if (n == 0) {
    cout << "-1\n";
    return 0;
  }
  vector<pair<long long, long long>> degs;
  if (n % 2 == 1) {
    for (int i = 0; i < n; ++i) {
      pair<long long, long long> ca = test(x[i], y[i], x, y, sx, sy, n);
      if (ca.first != 0 || ca.second != 0) {
        degs.push_back(ca);
      }
    }
  } else {
    for (int i = 1; i < n; ++i) {
      pair<long long, long long> ca =
          test((x[0] + x[i]) / 2, (y[0] + y[i]) / 2, x, y, sx, sy, n);
      if (ca.first != 0 || ca.second != 0) {
        degs.push_back(ca);
      }
    }
  }
  if (degs.size() == 0) {
    cout << "0\n";
    return 0;
  }
  sort(degs.begin(), degs.end());
  int ans = 1;
  for (int i = 1; i < degs.size(); ++i) {
    if (degs[i] != degs[i - 1]) {
      ++ans;
    }
  }
  cout << ans << "\n";
  return 0;
}

### Prompt

Create a solution in Cpp for the following problem:

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.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long double EPS = 1e-11;
const long long INFL = 1e16;
const int INF = 2e9 + 7;
mt19937 rnd((unsigned)chrono::steady_clock::now().time_since_epoch().count());
long long gcd(long long a, long long b) {
  if (a == 0 || b == 0) {
    return a + b;
  }
  return gcd(b, a % b);
}
pair<long long, long long> test(long long cx, long long cy, vector<long long> x,
                                vector<long long> y, long long sx, long long sy,
                                long long n) {
  sx -= n * cx;
  sy -= n * cy;
  for (int i = 0; i < n; ++i) {
    x[i] -= cx;
    y[i] -= cy;
  }
  long long a = 0 - sy, b = sx;
  if (a < 0 || a == 0 && b < 0) {
    a *= -1;
    b *= -1;
  }
  vector<long long> c(n);
  for (int i = 0; i < n; ++i) {
    c[i] = a * x[i] + b * y[i];
  }
  sort(c.begin(), c.end());
  for (int i = 0; i < n; ++i) {
    if (c[i] != 0 - c[n - i - 1]) {
      return {0, 0};
    }
  }
  return {a / gcd(a, b), b / gcd(a, b)};
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  long long n;
  cin >> n;
  vector<long long> x(n), y(n);
  long long sx = 0, sy = 0;
  for (int i = 0; i < n; ++i) {
    cin >> x[i] >> y[i];
    ;
    x[i] *= 2;
    y[i] *= 2;
    sx += x[i];
    sy += y[i];
  }
  for (int i = 0; i < n; ++i) {
    if (sx == x[i] * n && sy == y[i] * n) {
      sx -= x[i];
      sy -= y[i];
      --n;
      x.erase(x.begin() + i);
      y.erase(y.begin() + i);
      --i;
    }
  }
  for (int i = 0; i < n; ++i) {
    for (int j = i + 1; j < n; ++j) {
      if ((x[i] + x[j]) * n == sx * 2LL && (y[i] + y[j]) * n == sy * 2LL) {
        sx -= x[i] + x[j];
        sy -= y[i] + y[j];
        n -= 2;
        x.erase(x.begin() + j);
        x.erase(x.begin() + i);
        y.erase(y.begin() + j);
        y.erase(y.begin() + i);
        --i;
        break;
      }
    }
  }
  if (n == 0) {
    cout << "-1\n";
    return 0;
  }
  vector<pair<long long, long long>> degs;
  if (n % 2 == 1) {
    for (int i = 0; i < n; ++i) {
      pair<long long, long long> ca = test(x[i], y[i], x, y, sx, sy, n);
      if (ca.first != 0 || ca.second != 0) {
        degs.push_back(ca);
      }
    }
  } else {
    for (int i = 1; i < n; ++i) {
      pair<long long, long long> ca =
          test((x[0] + x[i]) / 2, (y[0] + y[i]) / 2, x, y, sx, sy, n);
      if (ca.first != 0 || ca.second != 0) {
        degs.push_back(ca);
      }
    }
  }
  if (degs.size() == 0) {
    cout << "0\n";
    return 0;
  }
  sort(degs.begin(), degs.end());
  int ans = 1;
  for (int i = 1; i < degs.size(); ++i) {
    if (degs[i] != degs[i - 1]) {
      ++ans;
    }
  }
  cout << ans << "\n";
  return 0;
}

```