Given up to 16 distinct points, pair them up to maximize the number of parallel pairs among the drawn segments.
Hard8Bit manipulationDynamic programmingGeometryCombinatoricsNo attempts yetTime limit10sMemory limit512 MBYou are given an even number of distinct points on the plane. Couple all of the points into pairs so that every point is coupled with exactly one other point, and consider every such coupling.
Draw the segment that connects the two points of each couple. Some of the drawn segments are parallel to others. Find the maximum number of parallel segment pairs over all possible couplings.
For the four points (0,0), (1,1), (0,2) and (2,4) there are three couplings, shown in Figure B.1. The numbers of parallel segment pairs are 0, 0 and 1, from the left, so the maximum is 1.

Figure B.1. All three possible couplings of the four points
Eight points can be coupled as shown in Figure B.2. With that coupling all four segments are parallel to one another, so the six pairs (L1,L2), (L1,L3), (L1,L4), (L2,L3), (L2,L4) and (L3,L4) are parallel and the maximum is 6.

Figure B.2. A coupling of eight points that maximizes the number of parallel segment pairs
The input consists of a single test case of the following format.
m
x1 y1
.
.
.
xm ym
The first line contains an even integer m, the number of points (2≤m≤16). Each of the following m lines gives the coordinates of one point. The integers xi and yi in the i-th of those lines are the x-coordinate and the y-coordinate of the i-th point (−1000≤xi≤1000, −1000≤yi≤1000).
All points are at different positions, that is, xi=xj or yi=yj holds for all i=j. No three points lie on a single line.
Print the maximum number of parallel segment pairs in one line.