#P3046. Lines of Symmetry

    ID: 16304 Type: Default 1000ms 256MiB

Lines of Symmetry

Lines of Symmetry

Farmer John has plotted the locations of his N cows on the 2D plane, each at distinct integer coordinates. He wonders how many different lines of symmetry exist for this set of points. A line of symmetry is defined as a line such that for every cow, the reflection of its location across the line is also a cow location.

The input begins with an integer N (2 ≤ N ≤ 1000), followed by N lines each containing two integers representing the coordinates of a cow. The output is a single integer representing the number of symmetry axes of the given set of points.

Note: If a candidate line maps every point to a point in the set, then it is a valid line of symmetry. Every candidate line can be generated either as the line through two points or as the perpendicular bisector of the segment joining two distinct points.

inputFormat

The first line contains an integer N (2 ≤ N ≤ 1000). Each of the next N lines contains two space‐separated integers x and y representing the coordinates of a cow.

outputFormat

Output a single integer: the number of distinct lines of symmetry for the set of cows.

sample

2
0 0
1 1
2