Sanghyeon's Physics and Experiment 1 Operation
InterviewTime limit1sMemory limit1024 MB
Given N densities and an error range E, count the groups of weights that link together when sorted neighbors differ by less than E.
Problem
Sanghyeon is taking Physics and Experiment 1 and measured the densities of weights, all made of a single material. Each weight is numbered from 1 to , and the density of weight is . He wants to use the densities to find how many different materials the weights are made of.
However, the density measurements are not exact. If the difference between the densities of two weights is less than the error range , he decides that the two weights are made of the same material. (For example, if the error range is , weights with densities , , , , , and are all judged to be made of the same material.)
Input
The first line contains two integers () and (), separated by a space.
The second line contains integers (), separated by spaces.
Output
Print the number of materials that the weights are made of.