e-olymp
favorite We need a little bit of your help to keep things running, click on this banner to learn more
Competitions

Data Structures contest

Pairs

Array of unique integers and a target value k are given. Determine the number of pairs of array elements that have a difference equal to a target value k.

Input

First line contains integers n (2n105) and k (0 < k < 109). Second line contains n unique integers in the range from 0 to 231 - 1.

Output

Print the number of pairs of array integers with difference k.

Explanation

In the sample there are two pairs of numbers with difference 3: (5, 2) and (10, 7).

Time limit 1 second
Memory limit 128 MiB
Input example #1
6 3
7 3 5 1 10 2
Output example #1
2