#ALLBARN2. All Possible Barns

All Possible Barns

Farmer John is going to build a new rectangular barn. But the 4 corners of the barn mustn't be on soft soil. He examined the ground and found that there are only N (4 <= N <= 1,000) appropriate points for the corners. He wants to know the number of possible ways to build the new barn.

Given the points, help him find the answer.

Input:

Input exactly contains 10 test cases each of them as follows:

  • Line 1: A single integer, N.
  • Lines 2..N+1: Each line has two space-separated integers x, y which are the coordinates of a point. The magnitude of the coordinates is not more than 16,000. All points will be distinct.

Output:

For each Test case print one line contains:

  • Line 1: The number of possible ways to build the new barn.

Sample:

Input
8
1 2
1 -2
2 1
2 -1
-1 2
-1 -2
-2 1
-2 -1
[and 9 more Test cases ...]

Output 6 [and 9 more Test cases ...]

</p>
Output Details:

The possible answers are: {1, 2, 6, 5}, {1, 3, 6, 8}, {1, 4, 6, 7}, {2, 3, 5, 8}, {2, 4, 5, 7}, {3, 4, 8, 7}