Pairs with Difference K
Count the distinct value pairs in the array with . (For , count values that appear at least twice.)
Input
, then integers, then .
Output
The number of distinct pairs.
Constraints
,
Sample 1
Input
5 3 1 4 1 5 2
Output
2
Sample 2
Input
5 1 3 1 5 4 0
Output
1