Farmer John's N cows are grazing along a straight fence. Cow i stands at position xi and has height hi.
A cow feels crowded when some cow at least twice her height stands within distance D to her left and some cow at least twice her height also stands within distance D to her right. Her left side is the range of positions from xi−D up to but not including xi, and her right side is the range above xi up to and including xi+D.
Crowded cows give less milk. Help Farmer John count how many of them there are.
The first line has two integers N and D.
Each of the next N lines has the position xi and the height hi of cow i. All positions are distinct. The input is not guaranteed to be sorted by position.
Print the number of crowded cows on one line.
The example has 6 cows and a distance threshold of D=4. The first cow stands at position 10 with height 3, and the remaining lines read the same way. The cows at positions 5 and 6 feel crowded, so the answer is 2.