You are given an array of distinct (x, y) coordinates. Create a function that returns how many rectangles these points form on the plane.
rectangles([[1, 1], [2, 1], [1, 2], [2, 2]]) ➞ 1
rectangles([[1, 1], [2, 1], [1, 2], [2, 2], [3, 1], [3, 2]]) ➞ 3
rectangles([[1, 1], [1, 2], [2, 1], [2, 2], [3, 1], [3, 2], [3, 3], [2, 3], [1, 3]]) ➞ 10
// Note: We have a rectangle with vertices (2, 1), (3, 2), (2, 3), and (1, 2).
Don't forget to count rectangles that aren't parallel to the x- and y-axis (see example #3).