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

#GD0000134. Nhuộm tất theo mẻ (Coloring Socks)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Nhuộm tất theo mẻ (Coloring Socks)

Coloring Socks

Source: Kattis

Version: Phuoc Hung OJ Extended

Problem Statement

There are nn socks, with color values cic_i. Each washing/dyeing batch may contain at most LL socks and must have maximum color minus minimum color at most DD. Every sock belongs to one batch. Minimize the number of batches.

Input

The first line has n,L,Dn,L,D. The next line contains nn color values cic_i.

Output

Print the minimum number of batches.

Subtasks

  • Subtask 1 (20 points): 1≤n≤201\le n\le 20; 1≤L≤n1\le L\le n; 0≤D≤1090\le D\le10^9; 0≤ci≤1090\le c_i\le10^9.
  • Subtask 2 (30 points): 1≤n≤12001\le n\le 1200; 1≤L≤n1\le L\le n; 0≤D≤1090\le D\le10^9; 0≤ci≤1090\le c_i\le10^9.
  • Subtask 3 (50 points): 1≤n≤1000001\le n\le 100000; 1≤L≤n1\le L\le n; 0≤D≤1090\le D\le10^9; 0≤ci≤1090\le c_i\le10^9.

Examples

Input

6 3 2
1 3 4 6 2 7

Output

3

Explanation

Sorted colors are 1,2,3,4,6,71,2,3,4,6,7. Groups [1,2,3][1,2,3], [4,6][4,6], and [7][7] satisfy the capacity and color-spread conditions. Two groups cannot satisfy both.