loop do
    t, d, l = gets.split.map(&:to_i)
    break if t == 0
    a = 0
    r = 0
    t.times do
        a += 1 if r > 0
        r = [r - 1, 0].max
        i = gets.to_i
        if i >= l
            r = d
        end
    end
    p a
end
