output_description: Print the maximum number of times we can do the operation.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N
      x_1 y_1
      :
      x_N y_N
attempt: N = int(input())
  points = []
  for i in range(0, N):
      points.append(list(map(int, input().split(" "))))
  abcd = list(set(sum(points, [])))
  count = 0
  for i, a in enumerate(abcd):
      for j, b in enumerate(abcd):
          for c in abcd[i + 1 :]:
              for d in abcd[j + 1 :]:
                  if a == c and b == d:
                      continue
                  p = []
                  if [a, b] not in points:
                      p.append([a, b])
                  if [a, d] not in points:
                      p.append([a, d])
                  if [c, b] not in points:
                      p.append([c, b])
                  if [c, d] not in points:
                      p.append([c, d])
                  if len(p) == 1:
                      count += 1
                      points.append(p[0])
  print(count)
  
problem_description: Statement
  
  There are N dots in a two-dimensional plane. The coordinates of the i-th dot
  are (x_i, y_i).
  
  We will repeat the following operation as long as possible:
  
    * Choose four integers a, b, c, d (a \neq c, b \neq d) such that there are dots at exactly three of the positions (a, b), (a, d), (c, b) and (c, d), and add a dot at the remaining position.
  
  We can prove that we can only do this operation a finite number of times. Find
  the maximum number of times we can do the operation.
samples: [{"input": "3\n    1 1\n    5 1\n    5 5", "output": "1\n    \n\nBy choosing a = 1, b = 1, c = 5, d = 5, we can add a dot at (1, 5). We cannot\ndo the operation any more, so the maximum number of operations is 1.\n\n* * *"}, {"input": "2\n    10 10\n    20 20", "output": "0\n    \n\nThere are only two dots, so we cannot do the operation at all.\n\n* * *"}, {"input": "9\n    1 1\n    2 1\n    3 1\n    4 1\n    5 1\n    1 2\n    1 3\n    1 4\n    1 5", "output": "16\n    \n\nWe can do the operation for all choices of the form a = 1, b = 1, c = i, d = j\n(2 \\leq i,j \\leq 5), and no more. Thus, the maximum number of operations is\n16."}]