Under construction

Still being built. Things may change

O Those Fads

Interview

Time limit1sMemory limit128 MB

Summary
Cows join a fad when its attractiveness L reaches their resistance; each joiner raises L by K. Count the final number of participants.
Level

Medium4 of 10

Topics
Sorting, Greedy, Simulation, Array
Solved
No attempts yet

Problem

Like any other teenager, teen cows are occasionally overtaken by fads. Sometimes it's a hula hoop or a pet rock, other times it's Counterstrike, Pokemon, Rick Astley, or tribal tattoos on their udders.

Mathematically, a fad has an initial attractiveness level LL (1≤L≤500001 \le L \le 50000). Cow ii has a resistance RiR_i (0≤Ri≤10000000 \le R_i \le 1000000) that tells how long she can hold out before joining the fad. When a fad's attractiveness level meets or exceeds a cow's resistance (L≥RiL \ge R_i), that cow wants to participate.

Each cow who participates increases (through peer pressure) the fad's attractiveness by some value KK (1≤K≤25001 \le K \le 2500). Because a higher attractiveness can pull in cows with greater resistance, participation happens in a cascade.

Given a population of NN (1≤N≤1000001 \le N \le 100000) cows, determine how many will ultimately participate in the fad.

Input

  • Line 1: Three space-separated integers NN, LL, and KK.
  • Lines 2 to N+1N+1: Line i+1i+1 contains a single integer RiR_i, the fad resistance of cow ii.

Output

  • Line 1: A single integer, the number of cows that ultimately participate in the fad.

Examples1

  1. Example 1

    Input
    5 2 3
    2
    6
    12
    5
    14
    
    Expected output
    3