An orchard has n distinct trees at integer coordinates. A square plot is an axis-aligned square (its sides parallel to the axes) with a strictly positive side length whose four corners are all trees in the orchard. Count how many distinct square plots exist. Two plots are the same only if they use the exact same four corner trees.
Input format
Line 1: an integer n, the number of trees.
Next n lines: two integers x y, the position of a tree. All positions are distinct.
Output format
A single integer: the number of axis-aligned square plots.
Constraints
- 1 <= n <= 2000
- -1000000 <= x, y <= 1000000
- All tree positions are distinct.