Counting Rectangles

Given n points on the XY plane, count how many regular rectangles are formed. A rectangle is regular if and only if its sides are all parallel to the axis. Input The first line contains the number of tests t (1 ≤ t ≤ 10). Each case contains a single line with a positive integer n (1 ≤ n ≤ 5000), the number of points. There are n lines follow, each line contains 2 integers x, y (≤ x, y ≤ 109) indicating the coordinates of a point. Output For each test case, print the case number and a single integer, the number of regular rectangles found. Sample Input 2 5 00 20 02 22 11 3 00 0 30 0 900 Sample Output Case 1: 1 Case 2: 0