#include <bits/stdc++.h>
using namespace std;
template <typename T>
struct outputer;
struct outputable {};
template <typename T>
inline auto sqr(T x) -> decltype(x * x) {
  return x * x;
}
template <typename T1, typename T2>
inline bool umx(T1 &a, T2 b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T1, typename T2>
inline bool umn(T1 &a, T2 b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
pair<int64_t, int64_t> operator+(const pair<int64_t, int64_t> &a,
                                 const pair<int64_t, int64_t> &b) {
  return pair<int64_t, int64_t>(a.first + b.first, a.second + b.second);
}
pair<int64_t, int64_t> operator-(const pair<int64_t, int64_t> &a,
                                 const pair<int64_t, int64_t> &b) {
  return pair<int64_t, int64_t>(a.first - b.first, a.second - b.second);
}
pair<int64_t, int64_t> operator*(const pair<int64_t, int64_t> &a, int64_t b) {
  return pair<int64_t, int64_t>(a.first * b, a.second * b);
}
pair<int64_t, int64_t> operator/(const pair<int64_t, int64_t> &a, int64_t b) {
  return pair<int64_t, int64_t>(a.first / b, a.second / b);
}
int64_t operator*(const pair<int64_t, int64_t> &a,
                  const pair<int64_t, int64_t> &b) {
  return a.first * b.first + a.second * b.second;
}
int64_t operator^(const pair<int64_t, int64_t> &a,
                  const pair<int64_t, int64_t> &b) {
  return a.first * b.second - a.second * b.first;
}
const int N = 2000;
struct Input {
  int n;
  pair<int64_t, int64_t> a[N];
  bool read() {
    if (!(cin >> n)) {
      return 0;
    }
    for (int i = int(0); i < int(n); ++i) {
      int first, second;
      scanf("%d%d", &first, &second);
      a[i] = pair<int64_t, int64_t>(first, second);
    }
    return 1;
  }
  void init(const Input &input) { *this = input; }
};
struct Data : Input {
  int64_t ans;
  void write() { cout << ans << endl; }
};
namespace Main {
struct Solution : Data {
  int64_t gcd(int64_t a_, int64_t b_) {
    if (a_ == 0) {
      return b_;
    }
    return gcd(b_ % a_, a_);
  }
  void solve() {
    pair<int64_t, int64_t> sum(0, 0);
    for (int i = int(0); i < int(n); ++i) {
      sum = sum + a[i];
    }
    pair<int64_t, int64_t> p;
    if (sum.first * 2 % n == 0 && sum.second * 2 % n == 0) {
      pair<int64_t, int64_t> o = sum * 2 / n;
      sort(a, a + n);
      bool found = 0;
      for (int i = int(0); i < int(n); ++i) {
        if (a[i] + a[n - 1 - i] != o) {
          if (a[i] + a[n - 1 - i] < o) {
            p = a[i];
          } else {
            p = a[n - 1 - i];
          }
          found = 1;
          break;
        }
      }
      if (!found) {
        ans = -1;
        return;
      }
    } else {
      p = a[0];
    }
    vector<pair<int64_t, int64_t> > qqq;
    for (int i = int(0); i < int(n); ++i) {
      pair<int64_t, int64_t> v = (p + a[i]) * n - sum * 2;
      if (v == pair<int64_t, int64_t>(0, 0)) {
        continue;
      }
      v = v / gcd(v.first, v.second);
      vector<int64_t> q;
      for (int j = int(0); j < int(n); ++j) {
        q.emplace_back((a[j] * 2 - (p + a[i])) ^ v);
      }
      sort((q).begin(), (q).end());
      ;
      bool ok = 1;
      int64_t o = q.front() + q.back();
      for (int j = int(0); j < int(n); ++j) {
        ok &= (q[j] + q[n - 1 - j] == o);
      }
      if (ok) {
        qqq.emplace_back(v);
      }
    }
    sort((qqq).begin(), (qqq).end());
    ans = int(unique((qqq).begin(), (qqq).end()) - qqq.begin());
  }
  void clear() { *this = Solution(); }
};
}  // namespace Main
Main::Solution sol;
int main() {
  cout.setf(ios::showpoint | ios::fixed);
  cout.precision(20);
  sol.read();
  sol.solve();
  sol.write();
  return 0;
}

### Prompt

In cpp, your task is to solve 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;
template <typename T>
struct outputer;
struct outputable {};
template <typename T>
inline auto sqr(T x) -> decltype(x * x) {
  return x * x;
}
template <typename T1, typename T2>
inline bool umx(T1 &a, T2 b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T1, typename T2>
inline bool umn(T1 &a, T2 b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
pair<int64_t, int64_t> operator+(const pair<int64_t, int64_t> &a,
                                 const pair<int64_t, int64_t> &b) {
  return pair<int64_t, int64_t>(a.first + b.first, a.second + b.second);
}
pair<int64_t, int64_t> operator-(const pair<int64_t, int64_t> &a,
                                 const pair<int64_t, int64_t> &b) {
  return pair<int64_t, int64_t>(a.first - b.first, a.second - b.second);
}
pair<int64_t, int64_t> operator*(const pair<int64_t, int64_t> &a, int64_t b) {
  return pair<int64_t, int64_t>(a.first * b, a.second * b);
}
pair<int64_t, int64_t> operator/(const pair<int64_t, int64_t> &a, int64_t b) {
  return pair<int64_t, int64_t>(a.first / b, a.second / b);
}
int64_t operator*(const pair<int64_t, int64_t> &a,
                  const pair<int64_t, int64_t> &b) {
  return a.first * b.first + a.second * b.second;
}
int64_t operator^(const pair<int64_t, int64_t> &a,
                  const pair<int64_t, int64_t> &b) {
  return a.first * b.second - a.second * b.first;
}
const int N = 2000;
struct Input {
  int n;
  pair<int64_t, int64_t> a[N];
  bool read() {
    if (!(cin >> n)) {
      return 0;
    }
    for (int i = int(0); i < int(n); ++i) {
      int first, second;
      scanf("%d%d", &first, &second);
      a[i] = pair<int64_t, int64_t>(first, second);
    }
    return 1;
  }
  void init(const Input &input) { *this = input; }
};
struct Data : Input {
  int64_t ans;
  void write() { cout << ans << endl; }
};
namespace Main {
struct Solution : Data {
  int64_t gcd(int64_t a_, int64_t b_) {
    if (a_ == 0) {
      return b_;
    }
    return gcd(b_ % a_, a_);
  }
  void solve() {
    pair<int64_t, int64_t> sum(0, 0);
    for (int i = int(0); i < int(n); ++i) {
      sum = sum + a[i];
    }
    pair<int64_t, int64_t> p;
    if (sum.first * 2 % n == 0 && sum.second * 2 % n == 0) {
      pair<int64_t, int64_t> o = sum * 2 / n;
      sort(a, a + n);
      bool found = 0;
      for (int i = int(0); i < int(n); ++i) {
        if (a[i] + a[n - 1 - i] != o) {
          if (a[i] + a[n - 1 - i] < o) {
            p = a[i];
          } else {
            p = a[n - 1 - i];
          }
          found = 1;
          break;
        }
      }
      if (!found) {
        ans = -1;
        return;
      }
    } else {
      p = a[0];
    }
    vector<pair<int64_t, int64_t> > qqq;
    for (int i = int(0); i < int(n); ++i) {
      pair<int64_t, int64_t> v = (p + a[i]) * n - sum * 2;
      if (v == pair<int64_t, int64_t>(0, 0)) {
        continue;
      }
      v = v / gcd(v.first, v.second);
      vector<int64_t> q;
      for (int j = int(0); j < int(n); ++j) {
        q.emplace_back((a[j] * 2 - (p + a[i])) ^ v);
      }
      sort((q).begin(), (q).end());
      ;
      bool ok = 1;
      int64_t o = q.front() + q.back();
      for (int j = int(0); j < int(n); ++j) {
        ok &= (q[j] + q[n - 1 - j] == o);
      }
      if (ok) {
        qqq.emplace_back(v);
      }
    }
    sort((qqq).begin(), (qqq).end());
    ans = int(unique((qqq).begin(), (qqq).end()) - qqq.begin());
  }
  void clear() { *this = Solution(); }
};
}  // namespace Main
Main::Solution sol;
int main() {
  cout.setf(ios::showpoint | ios::fixed);
  cout.precision(20);
  sol.read();
  sol.solve();
  sol.write();
  return 0;
}

```