PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#GD0000065. Xe buýt sân bay (Airport Bus)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Xe buýt sân bay (Airport Bus)

Airport Bus

Source: AtCoder

Version: Phuoc Hung OJ Extended

Problem Statement

There are NN passengers arriving at times TiT_i. Each bus seats at most CC people. Passenger ii must depart on a bus at some time in the inclusive interval [Ti,Ti+K][T_i,T_i+K]. Bus departure times may be arbitrary real numbers, and multiple buses may depart simultaneously. Minimize the number of buses.

Input

The first line contains N,C,KN,C,K. Each of the next NN lines contains one integer TiT_i.

Output

Print the minimum number of buses.

Subtasks

  • Subtask 1 (20 points): 2≤N≤242\le N\le 24; 1≤C,K≤1091\le C,K\le10^9; 1≤Ti≤1091\le T_i\le10^9 for every ii.
  • Subtask 2 (30 points): 2≤N≤20002\le N\le 2000; 1≤C,K≤1091\le C,K\le10^9; 1≤Ti≤1091\le T_i\le10^9 for every ii.
  • Subtask 3 (50 points): 2≤N≤1000002\le N\le 100000; 1≤C,K≤1091\le C,K\le10^9; 1≤Ti≤1091\le T_i\le10^9 for every ii.

Examples

Input

5 3 5
1
2
3
6
12

Output

3

Explanation

The passengers arriving at 1,2,31,2,3 can share one bus at time 33; the arrivals at 66 and 1212 need additional buses. Two buses are insufficient because arrivals at 11 and 1212 are too far apart under the waiting limit. The answer is 33.