Module: two pointers


Problem

2 /11


Pairs of points

Problem

There are N points on the line. It is required to count the number of index pairs (i, j) such that i < j and |ai - aj

Input
The first line contains two numbers N and D (1 <= N <= 105, 1 <= D <= 109). The second line contains N non-negative numbers, each of which is no more than 2*109.

Imprint
Display the answer to the problem.
 
Examples
# Input Output
1 5 3
1 3 4 7 8
5