Celtic Symmetry

Given up to 1000 distinct integer points in the plane, count the distinct lines of symmetry of the set.

Medium7GeometryHash mapSortingMathInterviewNo attempts yetTime limit2sMemory limit512 MB

Problem

After a class on ancient Irish history, Diarmuid took an interest in geometric patterns hidden in the locations of neolithic tombs around Ireland. He plots the positions of NN tombs on the plane, and no two tombs sit at the same point. Count the lines of symmetry of this set of points.

A line of symmetry is a line such that the points on one side are mirror images of the points on the other side. In other words, reflecting every point of the set across the line must give back exactly the same set.

Input

The first line contains the number of tombs NN (2N10002 \le N \le 1000).

Each of the next NN lines contains two integers xx and yy, the coordinates of one tomb, separated by a space (10000x,y10000-10000 \le x, y \le 10000). No coordinate pair is given twice.

Output

Print the number of distinct lines of symmetry of the point set.