Go: package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
)

func main() {
	io := NewIo()
	defer io.Flush()
	for {
		t, d, l := io.NextInt(), io.NextInt(), io.NextInt()
		if t == 0 {
			break
		}
		cnt := 0
		elapsed := math.MaxInt32
		for i := 0; i < t-1; i++ {
			x := io.NextInt()
			if x >= l {
				cnt++
				elapsed = 1
			} else if elapsed < d {
				cnt++
				elapsed++
			}
		}
		_ = io.NextInt()
		io.Println(cnt)
	}
}

// I/O template
type Io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

func NewIo() *Io {
	return &Io{
		reader: bufio.NewReader(os.Stdin),
		writer: bufio.NewWriter(os.Stdout),
	}
}

func (io *Io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

func (io *Io) NextLine() string {
	var buff []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buff = append(buff, line...)
		if !isPrefix {
			break
		}
	}
	return string(buff)
}

func (io *Io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	s := io.tokens[io.nextToken]
	io.nextToken++
	return s
}

func (io *Io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) NextFloat() float64 {
	i, err := strconv.ParseFloat(io.Next(), 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) Println(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}

func (io *Io) Printf(format string, a ...interface{}) {
	fmt.Fprintf(io.writer, format, a...)
}

func (io *Io) PrintIntSlice(a []int) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.Println(b...)
}

func (io *Io) PrintStringSlice(a []string) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.Println(b...)
}

func Log(name string, value interface{}) {
	fmt.Fprintf(os.Stderr, "%s=%+v\n", name, value)
}

func ExampleIo() {
	io := NewIo()
	defer io.Flush()
	a := make([]int, 0, 3)
	a[0], a[1], a[2] = io.NextInt(), io.NextInt(), io.NextInt()
	io.Println(a)
	io.PrintIntSlice(a)
	Log("io", a)
}

Python: while True:
    t,d,l=map(int,input().split())
    if t==0:
        break
    ls=[]
    for i in range(t):
        ls.append(int(input()))
    ans=0
    r=0
        
    for j in range(t):
        if ls[j]>=l:
            ans+=1
            if r<d:
                r=d-1
        else:
            if r>0:
                ans+=1
                r-=1
    if ans>0:
        print(ans-1)
    else:
        print(0)

Python: while 1:
    t,d,l=map(int,input().split())
    if not t+d+l:
        break
    a=0
    j=-1
    for i in range(t):
        x=int(input())
        a+=(j>-1and i-j<=d)
        if x>=l:
            j=i
    print(a)

Python: while True:
    try:
        T, D, L = map(int, input().split())
        if T == 0:
            break
        cnt = 0
        flag = 0
        delay = D
        for i in range(T):
            x = int(input())
            if x >= L:
                if flag == 1:
                    cnt += 1
                flag = 1
                delay = D
            else:
                if flag == 1:
                    delay -= 1
                    cnt += 1
                    if delay == 0:
                        flag = 0
        print(cnt)
    except:
        break

Python: while True:
    T,D,L = map(int,input().split())
    if T==0 and D ==0 and L == 0:
        break
    x = [int(input()) for i in range(T)]
    l = [0]*(T-1)
    i = 0
    m = 0
    while i<T-1:
         #for i in range(T-1):
        if m < i:
            m = i
        if x[i] >= L and D > m-i:
            tmp=m
            for j in range(D-(tmp-i)):
                if tmp<T-1:
                    l[tmp+j] = 1
                    m += 1
        i+=1
    total = 0
    for i in range(T-1):
        total += l[i]

    print(total)

Python: "海岸縁"
while True:
    T, D, L = map(int, input().split())
    if T == 0:
        break
    ans = 0
    wet = False
    desserttime = 0
    for i in range(T):
        if wet:
            ans += 1
        x = int(input())
        if x >= L:
            desserttime = D
        elif desserttime > 0:
            desserttime -= 1

        if desserttime == 0:
            wet = False
        else:
            wet = True

    print(ans)

Python: while True:
	t,d,l = map(int,input().split())
	if t+d+l == 0:break
	lst = []
	for i in range(t):
		x = int(input())
		if x >= l:
			lst.append(1)
		else:
			lst.append(0)
	ans = 0
	sd = 0
	for i,w in enumerate(lst[:-1]):
		if w == 1: 
			ans += 1
			if lst[i+1] != 1:
				sd = d-1
		else:
			if sd != 0:
				ans += 1
				sd -= 1
	
	print(ans)

Python: while True:
    T,D,L = map(int,input().split())
    if T==0 and D ==0 and L == 0:
        break
    x = [int(input()) for i in range(T)]
    beforeflag=0
    flag=0
    total=0
    for i in range(T):
        if x[i]>=L:
            flag=1
            if beforeflag!=D+1 and beforeflag!=0:
                total+=1
        elif x[i]<L and flag>0 and flag<=D:
            flag+=1
            total+=1
        else:
            flag=0
        beforeflag=flag
    print(total)

Python: import itertools
import operator

def f():
    t, d, l = map(int, input().split())
    if t == d == l == 0:
        return True

    hist = [0] * (10**5*2 + 1)
    for i in range(t):
        x = int(input())
        if x >= l:
            hist[i + 1] += 1
            hist[i + d + 1] -= 1

    print(sum(map(bool, itertools.accumulate(hist[:t], operator.add))))

while not f(): pass

Python: while True:
    t, d, l = map(int, input().split())
    if t == 0:break
    a = [int(input()) for _ in range(t)]
    w = 0
    wd = 0
    for i in range(t):
        if a[i] >= l:
            if wd:
                w += 1
                wd = d
            else:
                wd = d
        else:
            if wd:
                w += 1
                wd -= 1
    print(w)

Python: while True:
    T,D,L = map(int,input().split())
    if T==0 and D ==0 and L == 0:
        break
    x = [int(input()) for i in range(T)]
    l = [0]*(T-1)
    i = 0
    m = 0
    while i<T-1:
         #for i in range(T-1):
        if m < i:
            m = i
        if x[i] >= L and D > m-i:
            tmp=m
            for j in range(D-(tmp-i)):
                if tmp<T-1:
                    l[tmp+j] = 1
                    m += 1
        i+=1
    total = 0
    for i in range(T-1):
        total += l[i]

    print(total)

Python: while True:
    T, D, L = map(int, input().split())
    if T == 0:
        exit()
    ans = [0] * 200001
    for i in range(T):
        x = int(input())
        if i < T - 1 and x >= L:
            ans[i] += 1
            ans[i + D] -= 1

    for i in range(T):
        ans[i + 1] += ans[i]
    print(len([x for x in ans[:T - 1] if x > 0]))

Python: while True:
    T,D,L=map(int,input().split())
    if T==0 and D==0 and L==0:
        break
    rem,ans=0,0
    for _ in [0]*T:
        x=int(input())
        if x >= L:
            rem=D
        if rem:
            ans+=1
            rem-=1
    if ans:
        ans-=1
    print(ans)

Python: while(True):
	T,D,L = map(int, input().split())
	if (T+D+L) == 0:break
	x = [int(input()) for i in range(T)]
	count = 0
	lag = 0
	for i in range(T):
		if lag > 0 :
			count += 1
		if x[i] >= L:
			lag = D
		else:
			lag -= 1
	print(count)

Python: while True:
    T, D, L = map(int, input().split())
    if T == 0 and D == 0 and L == 0: break

    wet=[0]*(T+D)
    for i in range(T):
        if int(input())>=L : 
            wet[i] += 1
            wet[i+D] -= 1
    for i in range(1,T):
        wet[i] += wet[i-1]
    print(sum(x>0 for x in wet[:T-1]))