A class teacher calls the class monitor to assign a task. The task is to make the whole class stand in a row according to the roll number. The class monitor is asked to calculate the total number of roll number pairs (l, r), (l≤r) such that the absolute difference between the height of the tallest student among roll number l to roll number r and the height of the student whose roll number l is less than or equal to K.
There are N students in a class. The information of a class is given to you in the form of an array H.
Here, H[i] denotes the height of the student having roll number i.
Input format
Output format
The output contains a single integer denoting the number of required roll number pairs.
Constraints
1≤N≤1e61≤K≤1e91≤i≤N1≤H[i]≤1e9
The possible roll number pairs are :(1,1), (1,2), (2,2) , (2,3) and (3,3).