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

#TP0000070. Ghép cặp điểm xa nhau (Match Points)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Ghép cặp điểm xa nhau (Match Points)

Match Points

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

Given nn points on a number line, possibly with equal coordinates, form the maximum number of disjoint pairs such that each pair has distance at least zz.

Input

Line 1: n,zn,z. Line 2: nn integer coordinates.

Output

Print the maximum number of disjoint valid pairs.

Subtasks

  • Subtask 1 (20 points): Exactly one dataset; 2≤n≤122\le n\le12; 1≤z,xi≤1091\le z,x_i\le10^9; point coordinates may be equal.
  • Subtask 2 (30 points): Exactly one dataset; 2≤n≤20002\le n\le2000; 1≤z,xi≤1091\le z,x_i\le10^9; point coordinates may be equal.
  • Subtask 3 (50 points): Exactly one dataset; 2≤n≤2000002\le n\le200000; 1≤z,xi≤1091\le z,x_i\le10^9; point coordinates may be equal.

Example

Input

4 2
1 3 3 7

Output

2

Explanation

After sorting, pair 1 with 3 and the other 3 with 7, obtaining two disjoint pairs.