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 1:

    T, D, L = map(int, input().split())
    # T秒間の間観測, 毎秒波が押し寄せてくる。T個のx
    # 海岸はD秒たつと乾く
    # 距離Lだけ離れた地点が少なくても何秒濡れていたか
    if T == 0:
        exit()
    XXX = [int(input()) for i in range(T)]

    limit_time = 0
    ans = 0
    swet_time = 0
    for i, x in enumerate(XXX):
        if limit_time > 0:
            swet_time += 1
            limit_time -= 1

        if x >= L:
            limit_time = D


        if limit_time == 0:
            ans += swet_time
            swet_time = 0
        elif i == len(XXX)-1:
            ans += swet_time

    print(ans)

Python: while 1:
    T, D, L = map(int, input().split())
    # T秒間毎秒観測, T個の整数
    # 海岸はD秒後に乾く
    # 基準点から距離L離れたところが何秒間濡れていたか
    # i秒後にxiの地点まで波が押し寄せる
    if T == 0:
        exit()
    X = [int(input()) for _ in range(T)]
    wet_time = 0
    limit = 0
    ans = []

    for i in range(T):
        if limit > 0:
            limit -= 1
            wet_time += 1
        if X[i] >= L:
            limit = D  # 回復させる

        if limit == 0:
            ans.append(wet_time)
            wet_time = 0

    ans.append(wet_time)

    print(sum(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)]
    S = [0 for i in range(T)]
    for i in range(T):
        if X[i] >= L:
            S[i] += 1
            if i + D < T:
                S[i+D] += -1
    s = 0
    ans = 0
    for i in range(T-1):
        s += S[i]
        if s >= 1:
            ans += 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)]
    l = [0]*T
    for i in range(T-1):
        if x[i] >= L:
            for j in range(D):
                l[i+j] = 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 and D ==0 and L == 0:
        break
    x = [int(input()) for i in range(T)]
    l = [0]*(T-1)
    for i in range(T-1):
        if x[i] >= L:
            for j in range(D):
                if i+j<T-1:
                    l[i+j] = 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 and D ==0 and L == 0:
        break
    x = [int(input()) for i in range(T)]
    l = [0]*1000
    for i in range(T-1):
        if x[i] >= L:
            for j in range(D):
                if i+j<T-1:
                    l[i+j] = 1
    total = 0
    for i in range(T-1):
        total += l[i]

    print(total)

Python: while 1:
  t,d,l=map(int,input().split())
  if t==d==l==0:break
  x=[0]*(t+1)
  for i in range(t):
    s=int(input())
    if s<l:continue
    x[i]+=1
    x[min(i+d,t)]-=1
  y=[0]*t
  y[0]=x[0]
  for i in range(t-1):y[i+1]=y[i]+x[i+1]
  s=0
  for i in y[:-1]:
    if i>0:s+=1
  print(s)

Python: # AOJ 2824: Coastline
# Python3 2018.7.11 bal4u

while True:
	T, D, L = map(int, input().split())
	if T == 0: break
	a = []
	for i in range(T):
		x = int(input())
		if x >= L: a.append(i)
	T, ans = T-1, 0
	for i in range(1, len(a)):
		x = D
		if T-a[i-1] < D: x = T-a[i-1]
		if a[i]-a[i-1] < x: ans += a[i]-a[i-1]
		else: ans += x
	if a: ans += T-a[-1] if a[-1]+D > T else D
	print(ans)

Python: import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    rr = []

    def f(t,d,l):
        a = [I() for _ in range(t)]
        r = [0] * t
        for i in range(t-1,-1,-1):
            c = a[i]
            if c >= l:
                r[i] = 1
                for j in range(i+1,min(i+d,t)):
                    if r[j] > 0:
                        break
                    r[j] = 1

        return sum(r[:-1])

    while 1:
        n,m,l = LI()
        if n == 0:
            break
        rr.append(f(n,m,l))

    return '\n'.join(map(str, rr))


print(main())

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)
    for i in range(T-1):
        if x[i] >= L:
            for j in range(D):
                if i+j<T-1:
                    l[i+j] = 1
    total = 0
    for i in range(T-1):
        total += l[i]

    print(total)

C++: #include<stdio.h>
int main(){
	long T,D,L,x[100000]={};
	while(1){
		int count=0;
		scanf("%d %d %d",&T,&D,&L);
		if(T==0&&D==0&&L==0)break;
		for(int i=0;i<T;i++){
			scanf("%d",&x[i]);
		}
		for(int i=0;i<T;i++){
			if(x[i]>=L){
				for(int j=1;j<=D;j++){
					if((i+j)==T)break;
					if(x[i+j]<L){
						count++;
					}
					else{
						count++;
						break;
					}
				}
			}
		}		
		printf("%d\n",count);
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

int main() {
    int t, d, l, x[100005];
    while(cin >> t >> d >> l, t){
        for(int i=0;i<t;i++){
            cin >> x[i];
        }
        int ans = 0, r = 0;
        for(int i=0;i<t;i++,r--){
            if(r > 0) ans++;
            if(x[i] >= l){
                r = d+1;
            }
        }
        cout << ans << endl;
    }
    return 0;
}