889_D. Symmetric Projections
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.
```python
from fractions import Fraction
import time


class Point:
    def __init__(self, x, y):
        self.x = x
        self.y = y

    def to_tuple(self):
        return (self.x, self.y)

    def __repr__(self):
        return "Point({}, {})".format(self.x, self.y)

    def __eq__(self, other):
        return self.to_tuple() == other.to_tuple()

    def __hash__(self):
        return hash(self.to_tuple())

    def __neg__(self):
        return Point(-self.x, -self.y)

    def __add__(self, other):
        return Point(self.x+other.x, self.y+other.y)

    def __sub__(self, other):
        return self+(-other)

    def scalar_mul(self, mu):
        return Point(mu*self.x, mu*self.y)

    def int_divide(self, den):
        return Point(self.x//den, self.y//den)


class Line:
    def __init__(self, a, b, c):
        # ax+by+c=0
        self.a = a
        self.b = b
        self.c = c

    def __repr__(self):
        return "{}*x + {}*y + {} = 0".format(self.a, self.b, self.c)

    @classmethod
    def between_two_points(cls, P, Q):
        return cls(P.y-Q.y, Q.x-P.x, P.x*Q.y-P.y*Q.x)

    def evaluate(self, P):
        return self.a*P.x+self.b*P.y+self.c

    def direction(self):
        if self.a == 0:
            return (0, 1)
        return (1, Fraction(self.b, self.a))


def abs_sgn(x):
    if x == 0:
        return 0, 0
    if x < 0:
        return -x, -1
    return x, 1


def solve(tuple_points):
    points = set()
    center = Point(0, 0)
    for cur in tuple_points:
        cur = Point(*cur).scalar_mul(2*n)
        center += cur
        points.add(cur)

    center = center.int_divide(n)
    dcenter = center+center

    sym_points_set = set()
    for p in points:
        sym_points_set.add(dcenter-p)
    nosym = list(points - sym_points_set)

    if len(nosym) == 0:
        print(-1)
        exit(0)

    p0 = nosym[0]
    good_lines = set()
    for p in nosym:
        m = (p+p0).int_divide(2)
        line = Line.between_two_points(m, center)
        distances = list(map(line.evaluate, nosym))

        ok = True
        mydict = {}
        for dd in distances:
            dda, sgn = abs_sgn(dd)
            if dda not in mydict:
                mydict[dda] = sgn
            else:
                mydict[dda] += sgn
        for k in mydict:
            if mydict[k] != 0:
                ok = False
                break
        if ok:
            good_lines.add(line.direction())

    return len(good_lines)


# This one is accepted on CF
if __name__ == "__main__":
    n = int(input())
    pts = []
    for i in range(n):
        row = input().split(" ")
        cur = (int(row[0]), int(row[1]))
        pts.append(cur)
    print(solve(pts))

```