~/algor $ cat problems/ochkoz-nuqtalarni-qoplash
Covering points with segments
Medium
1000 ms
128 MB
49%
$n$ points are given on the number line: $x_{1}, x_{2}, \dots, x_{n}$ (some may coincide). You may take any number of segments of length $L$; the segment $[s; s + L]$ covers all points lying inside it or at its ends. What is the smallest number of segments needed to cover all the points?
Input
The first line contains two integers: $n$ and $L$. The second line contains $n$ space-separated integers $x_{i}$.
Output
One integer — the smallest number of segments.
Note
$1 \le n \le 10^{5}$
$0 \le L \le 10^{9}$
$-10^{9} \le x_{i} \le 10^{9}$
Examples
Input #1
5 2 9 1 5 2 6
Output #1
3
Input #2
3 0 4 4 4
Output #2
1