407699: GYM102878 A IQ difference

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

A. IQ differencetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

The registration for the 15-th BIT College Programming Contest has started. Students aren't waiting to form teams to join this competition. But high intensity and cooperation are required during this match, excluding some specialists teams up with his (her) girlfriend (boyfriend). So you will find that it's hard to communicate between pupil and grandmaster, especially coding in XCPC.

We define the IQ difference of a team as the differece between the maximum and minimum IQ of all team members. In other words, if the IQs of three participants are $$$c_i, c_j, c_k$$$, then this team's IQ difference is $$$\max\{c_i,c_j,c_k\}-\min\{c_i,c_j,c_k\}$$$.

Through the second law of cosmology, we know that the IQ difference of one XCPC team cannot exceed a balanced constant $$$C$$$. Now you are given a number of students who want to participant in the 15-th BITCPC, please help them to find out how many teams can be teamed up at most. Note that each team should exactly contains three participants.

Input

The input contains two lines, the first line contains two positive integers $$$n\ (1\le n\le 1\ 000)$$$ and $$$C\ (1\le C\le 50)$$$ — indicate the number of students and the equilibrium constant under the second law of the universe.

The second line contains $$$n$$$ separated non-negative integer $$$c_1, c_2, \cdots, c_n\ (0\le c_i\le 200)$$$ — indicate the IQ of these students.

Output

Please output a non-negative integer as the answer — indicating the maximum number of teams that this group of students can form.

ExampleInput
6 2
0 1 2 4 5 5
Output
2
Note

For the first example, the first 3 students form a team with an IQ difference of $$$2$$$, and the last $$$3$$$ students form another team with an IQ difference of $$$1$$$, so that all students can participate in the competition!

加入题单

上一题 下一题 算法标签: