The prison of your city has n prisoners. As the prison can't accommodate all of them, the city mayor has decided to transfer c of the prisoners to a prison located in another city.

For this reason, he made the n prisoners to stand in a line, with a number written on their chests. The number is the severity of the crime he/she has committed. The greater the number, the more severe his/her crime was.

Then, the mayor told you to choose the c prisoners, who will be transferred to the other prison. He also imposed two conditions. They are,

  The chosen c prisoners has to form a contiguous segment of prisoners.  Any of the chosen prisoner's crime level should not be greater then t. Because, that will make the prisoner a severe criminal and the mayor doesn't want to take the risk of his running away during the transfer. 

Find the number of ways you can choose the c prisoners.


-----Input-----

The first line of input will contain three space separated integers n (1 ≤ n ≤ 2·10^5), t (0 ≤ t ≤ 10^9) and c (1 ≤ c ≤ n). The next line will contain n space separated integers, the i^{th} integer is the severity i^{th} prisoner's crime. The value of crime severities will be non-negative and will not exceed 10^9. 


-----Output-----

Print a single integer — the number of ways you can choose the c prisoners.


-----Examples-----
Input
4 3 3
2 3 1 1

Output
2

Input
1 1 1
2

Output
0

Input
11 4 2
2 2 0 7 3 2 2 4 9 1 4

Output
6

Difficulty: EASY
Tags: Data structures

Implementation
Skill types: Data structures

Starter code:

Solutions:
(n, t, c) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
ans = 0
amount = 0
for i in a:
	if i <= t:
		amount += 1
	elif i > t:
		if amount >= c:
			ans += amount - c + 1
		amount = 0
if amount >= c:
	ans += amount - c + 1
print(ans)


def main():
	(n, t, c) = map(int, input().split())
	a = list(map(int, input().split()))
	count = 0
	pris_grp = 0
	for i in range(c):
		if a[i] > t:
			count += 1
	if count == 0:
		pris_grp += 1
	for i in range(c, n):
		if a[i - c] > t:
			count -= 1
		if a[i] > t:
			count += 1
		if count == 0:
			pris_grp += 1
	print(pris_grp)
main()


(n, t, c) = [int(i) for i in input().split()]
h = [int(i) for i in input().split()]
res = 0
cnt = 0
for i in h:
	if i > t:
		cnt = 0
	else:
		cnt += 1
	if cnt >= c:
		res += 1
print(res)


(n, t, c) = map(int, input().strip().split())
arr = list(map(int, input().strip().split()))
all_seq = []
curr_seq = []
for i in arr:
	if i > t:
		if len(curr_seq) > 0:
			all_seq.append(len(curr_seq))
			curr_seq = []
	else:
		curr_seq.append(i)
if len(curr_seq) > 0:
	all_seq.append(len(curr_seq))
counter = 0
for i in all_seq:
	counter += max(0, i - c + 1)
print(counter)


(n, t, c) = map(int, input().split())
a = list(map(int, input().split()))
s = [0 for i in a]
h = 0
l = 0

def push(i):
	nonlocal h, l, s, a
	while h < l and a[s[l - 1]] <= a[i]:
		l -= 1
	s[l] = i
	l += 1
for i in range(c):
	if a[i] > t:
		push(i)
if h == l:
	ans = 1
else:
	ans = 0
for i in range(c, n):
	if h < l and i - c == s[h]:
		h += 1
	if a[i] > t:
		push(i)
	if h == l:
		ans += 1
print(ans)


(n, t, c) = map(int, input().split())
line = list(map(int, input().split()))
line.append(t + 1)
start = -1
ans = 0
for i in range(n + 1):
	if line[i] > t:
		if i - start - 1 >= c:
			ans += i - start - c
		start = i
print(ans)


(z, zz) = (input, lambda : list(map(int, z().split())))
fast = lambda : stdin.readline().strip()
zzz = lambda : [int(i) for i in fast().split()]
(szz, graph, mod, szzz) = (lambda : sorted(zz()), {}, 10 ** 9 + 7, lambda : sorted(zzz()))
from string import *
from re import *
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f
from bisect import bisect as bs
from bisect import bisect_left as bsl
from itertools import accumulate as ac

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def prime(x):
	p = ceil(x ** 0.5) + 1
	for i in range(2, p):
		if x % i == 0 and x != 2 or x == 0:
			return 0
	return 1

def dfs(u, visit, graph):
	visit[u] = 1
	for i in graph[u]:
		if not visit[i]:
			dfs(i, visit, graph)
(n, t, c) = zz()
lst = zzz()
ans = []
lenth = 0
for i in lst:
	if i > t:
		if lenth <= 0:
			continue
		ans.append(lenth)
		lenth = 0
		continue
	lenth += 1
ans.append(lenth)
res = 0
for i in ans:
	res += max(0, i - c + 1)
print(res)


(n, t, c) = map(int, input().split())
prisoners = list(map(int, input().split()))
stack = []
ans = 0
for p in prisoners:
	if p <= t:
		stack.append(p)
		if len(stack) == c:
			ans += 1
			stack.pop()
	else:
		stack = []
print(ans)


(n, t, c) = map(int, input().split())
l = list(map(int, input().split()))
ans = 0
count = 0
for i in range(n):
	if l[i] <= t:
		count += 1
	else:
		count = 0
	if count >= c:
		ans += 1
print(ans)


import sys
import math
(n, t, c) = [int(x) for x in sys.stdin.readline().split()]
ni = [int(x) for x in sys.stdin.readline().split()]
k = 0
res = 0
for i in range(n):
	if ni[i] > t:
		if k - c >= 0:
			res += k - c + 1
		k = 0
	else:
		k += 1
if k - c >= 0:
	res += k - c + 1
print(res)


inp = input().split()
n = int(inp[0])
t = int(inp[1])
c = int(inp[2])
pris = list(map(int, input().split()))
last = -1
ans = 0
for i in range(n + 1):
	if i == n or pris[i] > t:
		ans += max(0, i - last - c)
		last = i
print(ans)


(n, t, c) = map(int, input().split())
ll = list(map(int, input().split())) + [t + 2]
sposob = 0
kol = [0] * (n + 1)
l = 0
for i in ll:
	if i <= t:
		l += 1
	else:
		kol[l] += 1
		l = 0
for i in range(c, n + 1):
	if kol[i] > 0:
		sposob += kol[i] * (i - c + 1)
print(sposob)


(n, t, c) = map(int, input().split())
x = list(map(int, input().split()))
goodpos = []
for i in range(n):
	if x[i] <= t:
		goodpos.append(i)
lens = []
streak = 1
for i in range(1, len(goodpos)):
	if goodpos[i] == goodpos[i - 1] + 1:
		streak += 1
	else:
		lens.append(streak)
		streak = 1
lens.append(streak)
if goodpos == []:
	lens = []
tot = 0
for i in lens:
	tot += max(i - c + 1, 0)
print(tot)


from collections import deque
(n, t, c) = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
cur_max = -1
left_to_right = deque()
right_to_left = deque()
for i in range(n):
	if i % c == 0:
		cur_max = a[i]
		left_to_right.append(cur_max)
	else:
		if a[i] > cur_max:
			cur_max = a[i]
		left_to_right.append(cur_max)
cur_max = -1
for i in range(n - 1, -1, -1):
	if cur_max == -1 or i % c == c - 1:
		cur_max = a[i]
		right_to_left.appendleft(cur_max)
	else:
		if a[i] > cur_max:
			cur_max = a[i]
		right_to_left.appendleft(cur_max)
for i in range(n - c + 1):
	if max(right_to_left[i], left_to_right[i + c - 1]) <= t:
		ans += 1
print(ans)


(n, t, c) = map(int, input().split())
a = list(map(int, input().split()))
b = [-1]
res = 0
tmp = 0
for i in range(n):
	if a[i] > t:
		b.append(i)
b.append(n)
for i in range(1, len(b)):
	tmp = b[i] - b[i - 1] - 1
	res += max(tmp - c + 1, 0)
print(res)


(n, t, c) = map(int, input().split())
arr = list(map(int, input().split()))
count = 0
ans = 0
for x in arr:
	if x <= t:
		count += 1
	else:
		temp = count - c + 1
		if temp < 0:
			temp = 0
		ans += temp
		count = 0
temp = count - c + 1
if temp < 0:
	temp = 0
print(ans + temp)


(n, t, c) = [int(x) for x in input().split()]
prisoners = [int(x) for x in input().split()]
more_than_t = [0]
for i in range(n):
	if prisoners[i] > t:
		more_than_t.append(i + 1)
more_than_t.append(n + 1)
i = 0
result = 0
while i < len(more_than_t) - 1:
	diff = more_than_t[i + 1] - more_than_t[i] - 1
	if diff >= c:
		result += diff - c + 1
	i += 1
print(result)


def get_ans():
	(n, t, c) = map(int, input().split())
	l = list(map(int, input().split()))
	st = 0
	en = 0
	ans = 0
	for (idx, i) in enumerate(l):
		if i > t:
			en = idx - 1
			if en < st:
				st = idx + 1
				continue
			else:
				ll = en - st + 1
				if ll < c:
					st = idx + 1
					continue
				else:
					st = idx + 1
					ans += ll - c + 1
		if idx == len(l) - 1:
			if i <= t:
				en = idx
				ll = en - st + 1
				if c <= ll:
					ans += ll - c + 1
	print(ans)
get_ans()


def inp():
	return map(int, input().split())

def arr_inp():
	return [int(x) for x in input().split()]
(n, t, c) = inp()
a = arr_inp()
(p1, p2, count, ans) = (0, 0, 1, 0)
while p2 < n:
	if a[p2] <= t:
		if count == c:
			ans += 1
			p1 += 1
		else:
			count += 1
		p2 += 1
	else:
		p2 += 1
		p1 = p2
		count = 1
print(ans)


import math
import sys
import collections

def getdict(n):
	d = {}
	if type(n) is list:
		for i in n:
			if i in d:
				d[i] += 1
			else:
				d[i] = 1
	else:
		for i in range(n):
			t = ii()
			if t in d:
				d[t] += 1
			else:
				d[t] = 1
	return d

def cdiv(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)
(n, t, c) = mi()
d = li()
r = q = 0
for i in d:
	if i > t:
		q = 0
	else:
		q += 1
		if q == c:
			(r, q) = (r + 1, q - 1)
print(r)


(n, t, c) = map(int, input().split())
a = list(map(int, input().split()))
count = 0
start = 0
i = 0
co = 0
while i < n:
	if a[i] <= t:
		co += 1
	else:
		co = 0
	if co >= c:
		count += 1
	i += 1
print(count)


(n, t, c) = [int(x) for x in input().split()]
prisoners = [int(x) for x in input().split()]
result = 0
temp = 0
for i in range(n + 1):
	if i < n and prisoners[i] <= t:
		temp += 1
	elif temp >= c:
		result += temp - c + 1
		temp = 0
	else:
		temp = 0
print(result)


(n, t, c) = map(int, input().split())
l = [-1 if int(i) > t else int(i) for i in input().split()]
x = 0
ans = 0
for i in range(len(l)):
	if not l[i] is -1:
		x += 1
	else:
		p = x - c + 1
		if p < 0:
			x = 0
			continue
		else:
			ans += p
			x = 0
r = x - c + 1
if r < 0:
	print(ans)
else:
	print(ans + r)


(n, dng, bus) = map(int, input().split())
l = list(map(int, input().split())) + [10 ** 9 + 1]
res = 0
cont = 0
for i in l:
	if i <= dng:
		cont += 1
	else:
		if cont >= bus:
			a = cont - bus + 1
			res += a
		cont = 0
print(res)


import sys
(n, t, c) = map(int, sys.stdin.readline().split())
an = list(map(int, sys.stdin.readline().split()))
ans = 0
pre = -1
for i in range(n + 1):
	if i == n or (i < n and an[i] > t):
		cnt = i - pre - 1
		pre = i
		if cnt >= c:
			ans += cnt - c + 1
print(ans)


(n, t, c) = map(int, input().split())
x = list(map(int, input().split()))
b = 0
e = 0
p = 0
while b < n:
	if x[b] <= t:
		e += 1
		if e >= c:
			p += 1
	else:
		e = 0
	b += 1
print(p)


(n, t, c) = map(int, input().split())
plist = list(map(int, input().split()))
a = ans = 0
for i in range(n):
	if plist[i] <= t:
		a += 1
	else:
		if a >= c:
			ans += a - c + 1
		a = 0
if a >= c:
	ans += a - c + 1
print(ans)


def solve(total, t, req, p):
	p.append(None)
	pointer_a = 0
	pointer_b = 1
	ans = 0
	while pointer_a <= total - req:
		if p[pointer_a] > t:
			pointer_a = pointer_b
			pointer_b += 1
			continue
		elif p[pointer_b] == None:
			pass
		elif p[pointer_b] <= t:
			pass
		elif pointer_b - pointer_a + 1 <= req:
			pointer_a = pointer_b + 1
			pointer_b += 2
			continue
		if pointer_b - pointer_a + 1 >= req:
			ans += 1
			pointer_a += 1
			pointer_b += 1
		else:
			pointer_b += 1
	return ans
(total, t, c) = list(map(int, input().split()))
p = list(map(int, input().split()))
print(solve(total, t, c, p))


import sys
(n, t, c) = map(int, sys.stdin.readline().split())
a = list(map(int, sys.stdin.readline().split()))
beg = 0
end = 0
ans = 0
for i in range(n):
	if a[i] > t:
		if end == i - 1:
			ans += max(end - beg - c + 2, 0)
		beg = i + 1
		end = i + 1
	elif i == n - 1:
		ans += max(n - beg - c + 1, 0)
	else:
		end = i
print(ans)


(n, t, c) = [int(x) for x in input().split()]
crime = [int(x) for x in input().split()]
count = 0
res = 0
for x in crime:
	if x <= t:
		count += 1
	else:
		if count >= c:
			res += count - c + 1
		count = 0
if count >= c:
	res += count - c + 1
print(res)


in1 = tuple(map(lambda x: int(x), input().split()))
prisoners = list(map(lambda x: int(x), input().split()))
n = in1[0]
t = in1[1]
c = in1[2]
count = 0
l = []
prisoners.append(float('inf'))
for p in prisoners:
	if p <= t:
		count += 1
	else:
		l.append(count)
		count = 0
l = list(filter(lambda x: x >= c, l))
result = 0
for value in l:
	result = result + value - c + 1
print(result)


def main():
	(n, t, c) = [int(c) for c in input().split()]
	s = ''.join([str(int(int(c) <= t)) for c in input().split()])
	s = s.split('0')
	res = 0
	for e in s:
		if len(e) >= c:
			res += len(e) - c + 1
	print(res)
main()


(n, t, c) = input().split(' ')
(n, t, c) = (int(n), int(t), int(c))
a = [int(x) for x in input().split(' ')]
j = 0
m = 0
for i in range(0, len(a)):
	if a[i] <= t:
		j += 1
	elif a[i] > t:
		j = 0
	if j >= c:
		m += 1
print(m)


from math import ceil
(n, t, c) = [int(x) for x in input().split()]
prisoners = [int(x) for x in input().split()]
segments = []
segments.append(0)
for i in range(n):
	if prisoners[i] > t:
		segments.append(i + 1)
segments.append(n + 1)
total = 0
for i in range(1, len(segments)):
	total += segments[i] - segments[i - 1] - c if segments[i] - segments[i - 1] > c else 0
print(total)


(n, t, c) = map(int, input().split())
a = list(map(int, input().split()))
summ = 0
count = 0
for i in range(n):
	if a[i] <= t:
		count += 1
	else:
		if count >= c:
			summ += count - c + 1
		count = 0
if count >= c:
	summ += count - c + 1
print(summ)


(numPrisoners, maxSeverity, choiceLenght) = tuple(map(int, input().split(' ')))
prisoners = list(map(int, input().split(' ')))
threats_index = [-1]
for i in range(len(prisoners)):
	if prisoners[i] > maxSeverity:
		threats_index += [i]
threats_index += [len(prisoners)]
choicePossibilities = 0
for i in range(len(threats_index) - 1):
	interval = threats_index[i + 1] - threats_index[i] - 1
	if interval >= choiceLenght:
		choicePossibilities += interval - choiceLenght + 1
print(choicePossibilities)


a = input().split(' ')
a = [int(x) for x in a]
(n, t, c) = (a[0], a[1], a[2])
prisoners = input().split()
prisoners = [int(x) for x in prisoners]
d = []
ctr = 0
for x in prisoners:
	if x <= t:
		ctr += 1
	else:
		d.append(ctr - c + 1)
		ctr = 0
d.append(ctr - c + 1)
d = [x for x in d if x > 0]
print(sum(d))


(n, t, c) = map(int, input().split())
(k, s) = (c - 1, 0)
for (i, j) in enumerate(map(int, input().split())):
	if j > t:
		s += max(0, i - k)
		k = i + c
print(s + max(0, n - k))


def fun():
	s = input().split()
	n = int(s[0])
	t = int(s[1])
	l = int(s[2])
	arr = input().split()
	count = 0
	les = 0
	a = [-1]
	for i in range(n):
		if int(arr[i]) > t:
			a.append(i)
	a.append(n)
	for i in range(1, len(a), 1):
		diff = a[i] - a[i - 1] - 1
		count += max(diff - l + 1, 0)
	print(count)
fun()


(n, t, c) = map(int, input().split())
lis = [int(x) for x in input().split()]
ans = 0
cnt = 0
for i in lis:
	if i <= t:
		cnt += 1
	else:
		cnt = 0
	if cnt >= c:
		ans += 1
print(ans)


def solve(n, t, c, prisoners):
	(ans, temp) = (0, 0)
	for i in range(n):
		if prisoners[i] <= t:
			temp += 1
		else:
			if temp >= c:
				ans += temp - c + 1
			temp = 0
	if temp >= c:
		ans += temp - c + 1
	return ans
(n, t, c) = map(int, input().split(' '))
prisoners = list(map(int, input().split(' ')))
print(solve(n, t, c, prisoners))


(n, t, c) = map(int, input().split())
ps = list(map(int, input().split()))
s = [0] + [i + 1 for i in range(n) if ps[i] > t] + [n + 1]
print(sum((s[i] - s[i - 1] - c for i in range(1, len(s)) if s[i] - s[i - 1] > c)))


(n, t, c) = map(int, input().split())
x = 0
z = 0
b = []
for i in map(int, input().split()):
	if i <= t:
		x += 1
	else:
		x = 0
	if x >= c:
		z += 1
print(z)


(n, t, c) = map(int, input().split())
val = v = 0
for i in input().split():
	if int(i) > t:
		v = 0
	else:
		v = v + 1
	if v >= c:
		val = val + 1
print(val)


(prisonNum, crimeStd, chooseNum) = map(int, input().split())
crimeLv = list(map(int, input().split()))
newList = []
prev = 0
for i in range(prisonNum):
	if crimeLv[i] > crimeStd:
		if prev == i:
			prev = i + 1
		else:
			newList.append(crimeLv[prev:i])
			prev = i + 1
if prev <= prisonNum - 1:
	newList.append(crimeLv[prev:prisonNum])
count = 0
for crimeList in newList:
	if len(crimeList) < chooseNum:
		continue
	elif len(crimeList) == chooseNum:
		count += 1
		continue
	else:
		count += len(crimeList) - chooseNum + 1
print(count)


(n, t, c) = map(int, input().split())
seq = list(map(int, input().split()))
(start, end) = (0, 0)
res = 0
for i in range(n):
	if seq[i] <= t:
		if end - start + 1 == c:
			start += 1
			res += 1
		end += 1
	else:
		(start, end) = (i, i)
print(res)


(n, t, c) = input().split()
n = int(n)
t = int(t)
c = int(c)
ans = 0
k = 0
for i in input().split():
	if int(i) <= t:
		k += 1
	else:
		k = 0
	if k >= c:
		ans += 1
print(ans)


(n, t, e) = map(int, input().split())
c = list(map(int, input().split()))
w = 0
for y in range(n):
	if c[y] > t:
		c[y] = ' '
	else:
		c[y] = 'x'
for z in ''.join(c).split():
	w += max(0, len(z) - e + 1)
print(w)


(N, t, c) = map(int, input().strip().split())
A = list(map(int, input().strip().split()))
N = len(A)
ans = 0
cont = 0
for i in range(N):
	if A[i] <= t:
		cont += 1
	else:
		cont = 0
	if cont >= c:
		ans += 1
print(ans)


R = lambda : map(int, input().split())
(n, t, c) = R()
p = list(R())
m = 0
i = 0
l = 0
while i < n:
	x = p[i]
	if x > t:
		l = i + 1
	elif i - l + 1 == c:
		m += 1
		l += 1
	i += 1
print(m)


import copy
import sys
from collections import defaultdict, Counter

def input():
	return sys.stdin.readline()

def mapi():
	return map(int, input().split())

def maps():
	return map(str, input().split())

def print(arg, *argv, sep='', end=None):
	sys.stdout.write(str(arg))
	for i in argv:
		sys.stdout.write(sep + str(i)) if sep else sys.stdout.write(' ' + str(i))
	sys.stdout.write(end) if end else sys.stdout.write('\n')

def GCD(x, y):
	return GCD(y, x % y) if y else x

def modPow(x, y, p):
	(res, x) = (1, x % p)
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		(y, x) = (y >> 1, x * x % p)
	return res

def modInv(s, mod):
	return modPow(s, mod - 2, mod)

def solve():
	t = 1
	while t:
		t -= 1
		(n, x, c) = mapi()
		a = list(mapi())
		res = 0
		cnt = 0
		for i in range(n):
			if a[i] <= x:
				cnt += 1
			else:
				if cnt >= c:
					res += cnt - c + 1
				cnt = 0
		if cnt >= c:
			res += cnt - c + 1
		print(res)
solve()


(n, t, c) = map(int, input().split())
A = list(map(int, input().split()))
numIn = 0
for i in range(c):
	if A[i] > t:
		numIn += 1
ans = 0
r = c
while r < n:
	if numIn == 0:
		ans += 1
	if A[r - c] > t:
		numIn -= 1
	if A[r] > t:
		numIn += 1
	r += 1
if numIn == 0:
	ans += 1
print(ans)


(n, t, c) = map(int, input().split())
arr = list(map(int, input().strip().split()))
i = 0
k = 0
res = 0
while i < n:
	if arr[i] <= t:
		k += 1
	else:
		k = 0
	if k >= c:
		res += 1
	i += 1
print(res)


import os
import re
import sys
from bisect import bisect, bisect_left, insort, insort_left
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from io import BytesIO, IOBase
from itertools import accumulate, combinations, combinations_with_replacement, groupby, permutations, product
from math import acos, asin, atan, ceil, cos, degrees, factorial, hypot, log2, pi, radians, sin, sqrt, tan
from operator import itemgetter, mul
from string import ascii_lowercase, ascii_uppercase, digits

def inp():
	return int(input())

def inlist():
	return list(map(int, input().split()))

def instr():
	s = input()
	return list(s[:len(s)])

def invr():
	return map(int, input().split())
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')
(n, t, c) = invr()
a = inlist()
res = 0
x = 0
for i in range(n):
	if a[i] <= t:
		x += 1
	else:
		res += max(0, x - c + 1)
		x = 0
res += max(0, x - c + 1)
print(res)


(n, t, c) = map(int, input().split())
a = list(map(int, input().split()))
i = 0
j = 0
ans = 0
for k in range(len(a)):
	if a[k] > t:
		if j - i >= c:
			ans += j - i - c + 1
		i = k + 1
		j = k + 1
	else:
		j += 1
if j - i >= c:
	ans += j - i - c + 1
print(ans)


(n, t, c) = map(int, input().split())
prisoners = list(map(int, input().split()))
start = 0
end = 0
result = 0
for end in range(len(prisoners)):
	if prisoners[end] > t:
		length = end - start
		if length >= c:
			result += length - c + 1
		start = end + 1
if end - start + 1 >= c:
	result += end - start - c + 2
print(result)


(n, t, c) = map(int, input().split())
Arr = [int(_) for _ in input().split()]
excount = 0
if c == 1:
	for item in Arr:
		if item <= t:
			excount += 1
	print(excount)
elif len(set(Arr)) == 1 and Arr[0] > t:
	print('0')
else:
	i = 0
	count = 0
	while Arr[i] > t:
		i += 1
	j = i + 1
	while j < n and i <= j:
		if Arr[j] > t:
			j += 1
			i = j
		elif (j - i + 1) % c == 0 and Arr[j] <= t and (Arr[i] <= t):
			count += 1
			i += 1
			j += 1
		else:
			j += 1
	print(count)


(n, t, c) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
pref = [0]
for i in range(n):
	if a[i] > t:
		pref.append(pref[-1] + 1)
	else:
		pref.append(pref[-1])
cnt = 0
for i in range(n - c + 1):
	if pref[i] == pref[i + c]:
		cnt += 1
print(cnt)


(n, t, c) = map(int, input().split())
l = list(map(int, input().split()))
s = [0] * n
for i in range(n):
	s[i] = l[i] > t
ans = 0
k = 0
for i in range(n):
	if s[i] == 0:
		k += 1
	else:
		ans += max(k - c + 1, 0)
		k = 0
print(ans + max(k - c + 1, 0))


(n, t, c) = map(int, input().split())
p = [int(i) for i in input().split()]
i = 0
ch = 0
while i < n:
	if p[i] > t:
		i += 1
	else:
		l = 0
		j = i
		while j < n and p[j] <= t:
			l += 1
			j += 1
		if l >= c:
			ch += l - c + 1
		i = j
print(ch)


(n, t, c) = map(int, input().split())
l = [int(x) for x in input().split()]
a = 0
b = 0
for i in range(n):
	if l[i] > t:
		if a >= c:
			b += a - c + 1
		a = 0
	else:
		a += 1
if a >= c:
	b += a - c + 1
print(b)


(n, t, c) = tuple(map(int, input().split()))
s = list(map(int, input().split()))
k = 0
i = 0
j = 0
while i < n:
	if s[i] > t:
		j = 0
	else:
		j += 1
		if j >= c:
			k += 1
	i += 1
print(k)


import sys
(n, t, c) = map(int, input().split(' ', 3))
v = [int(x) for x in input().split()]
i = 0
sol = 0
cnt = 0
while i < len(v):
	if v[i] <= t:
		cnt += 1
	else:
		cnt = 0
	if cnt >= c:
		sol += 1
	i += 1
print(sol)


def main():
	(n, t, c) = map(int, input().split())
	l = list(map(int, input().split()))
	cnt = sum((_ > t for _ in l[:c]))
	res = int(not cnt)
	for (a, b) in zip(l, l[c:]):
		cnt += (b > t) - (a > t)
		if not cnt:
			res += 1
	print(res)
main()


(n, t, c) = map(int, input().split())
k = 0
s = 0
for i in list(map(int, input().split())):
	if i <= t:
		k += 1
		if k >= c:
			s += 1
	else:
		k = 0
print(s)


(n, t, c) = map(int, input().split())
s = list(map(int, input().split()))
curr = 0
l = []
ch = 0
for i in range(n):
	if s[i] > t:
		if i == n - 1:
			ch = 1
		l.append(i - curr)
		curr = i + 1
if ch == 0:
	l.append(n - curr)
ans = 0
for i in range(len(l)):
	if l[i] - c + 1 > 0:
		ans += l[i] - c + 1
print(ans)


(n, t, c) = map(int, input().split())
(x, y) = (0, 0)
a = list(map(int, input().split()))
for i in a:
	if i <= t:
		x += 1
	else:
		x = 0
	if x >= c:
		y += 1
print(y)


(n, t, c) = list(map(int, input().split()))
lista = list(map(int, input().split()))
segments = []
cont = 0
for i in lista:
	if i <= t:
		cont += 1
	else:
		segments.append(cont)
		cont = 0
if cont != 0:
	segments.append(cont)
	cont = 0
res = 0
for i in segments:
	if i >= c:
		res += i - c + 1
print(res)


import sys

def __starting_point():
	(n, t, c) = list(map(int, sys.stdin.readline().split()))
	prisoners = list(map(int, sys.stdin.readline().split()))
	cnt = 0
	risk = 0
	for i in range(c):
		if t < prisoners[i]:
			risk += 1
	if not risk:
		cnt += 1
	for i in range(c, n):
		if t < prisoners[i]:
			risk += 1
		if t < prisoners[i - c]:
			risk -= 1
		if not risk:
			cnt += 1
	print(cnt)
__starting_point()


(n, t, c) = (int(i) for i in input().split())
ctr = 0
ans = 0
for i in input().split():
	a = int(i)
	if a > t:
		ctr = 0
	else:
		ctr += 1
		if ctr >= c:
			ans += 1
print(ans)


(n, t, c) = [int(i) for i in input().split()]
crime = [1 if int(i) <= t else 0 for i in input().split()]
sta = 0
ans = 0
for i in crime:
	if i == 0:
		sta = 0
	else:
		sta += 1
	if sta >= c:
		ans += 1
print(ans)


(n, t, c) = map(int, input().split())
l = list(map(int, input().split()))
x = 0
s = 0
for i in range(n):
	if l[i] <= t:
		x += 1
	else:
		if x >= c:
			s += x - c + 1
		x = 0
if x >= c:
	s += x - c + 1
print(s)


(n, t, c) = map(int, input().split())
Array = list(map(int, input().split()))
windowSize = c
Count1 = 0
Count2 = 0
for i in range(n):
	if Array[i] <= t:
		Count1 = Count1 + 1
	else:
		Count1 = 0
	if Count1 >= c:
		Count2 = Count2 + 1
print(Count2)


(n, t, c) = map(int, input().split())
a = list(map(int, input().split()))
cnt = 0
l = 0
i = 0
while i < len(a):
	while i < len(a) and a[i] <= t:
		i += 1
	L = i - l
	if L >= c:
		cnt += L - c + 1
	i += 1
	l = i
print(cnt)


import bisect
import collections
import copy
import functools
import heapq
import itertools
import math
import random
import re
import sys
import time
import string
from typing import List
sys.setrecursionlimit(99999)
(n, t, c) = map(int, sys.stdin.readline().split())
arr = list(map(int, sys.stdin.readline().split()))
dp = [0] * n
if arr[0] <= t:
	dp[0] = 1
for i in range(1, n):
	if arr[i] <= t:
		dp[i] = dp[i - 1] + 1
print(sum((x >= c for x in dp)))


(n, m, k) = map(int, input().split())
c = list(map(int, input().split()))
l = 0
x = 0
for i in range(n):
	if c[i] <= m:
		x += 1
		if x >= k:
			l += 1
	else:
		x = 0
print(l)


from sys import stdin, stdout
from math import factorial as f
inp = stdin.readline
op = stdout.write
(n, t, c) = list(map(int, inp().split()))
dp = []
a = list(map(int, inp().split()))
temp = 0
for i in range(n):
	if a[i] <= t:
		temp = temp + 1
	else:
		dp.append(temp)
		temp = 0
dp.append(temp)
sums = 0
n = len(dp)
for i in range(n):
	temp = dp[i]
	if c <= temp:
		sums = sums + (temp - c + 1)
op(str(sums))


(n, limit, c) = map(int, input().split())
listn = list(map(int, input().split()))
res = 0
prev = -1
i = 0
while i < n:
	if listn[i] > limit:
		res += max(i - prev - c, 0)
		prev = i
	i += 1
res += max(n - prev - c, 0)
print(res)


(n, t, c) = map(int, input().split())
arr = list(map(int, input().split()))
pointer = 0
count = 0
for i in range(len(arr)):
	if arr[i] <= t:
		pointer += 1
	else:
		pointer = 0
	if pointer == c:
		count += 1
		pointer -= 1
print(count)


(n, t, c) = map(int, input().split())
data = list(map(int, input().split()))
count = 0
answer = 0
for i in range(len(data)):
	if data[i] > t:
		answer += max(0, count - c + 1)
		count = 0
	else:
		count += 1
answer += max(0, count - c + 1)
print(answer)


(n, t, c) = map(int, input().split())
arr = list(map(int, input().split())) + [t + 1]
var = 0
count = 0
check = 0
for i in range(n):
	if var == 0 and arr[i] <= t:
		start = i
		var = 1
		check = 1
	if var == 1 and arr[i + 1] > t:
		end = i
		var = 0
		if end - start + 1 >= c:
			count += end - start + 1 - c + 1
if check == 0:
	print(0)
else:
	print(count)


(n, t, c) = input().split()
(n, t, c) = (int(n), int(t), int(c))
l = input().split()
for i in range(n):
	l[i] = int(l[i])
i = 0
q = 0
while i < n:
	if l[i] > t:
		i += 1
		continue
	s = 0
	j = i
	while j < n and l[j] <= t:
		s += 1
		j += 1
	if s >= c:
		q += s - c + 1
	i = j
print(q)


(n, t, c) = list(map(int, input().split()))
arr = [int(x) for x in input().split()]
i = 0
j = 0
ans = 0
while j < n:
	if arr[j] > t:
		j += 1
		i = j
	else:
		diff = j - i + 1
		if diff == c:
			ans += 1
			j += 1
			i += 1
		else:
			j += 1
print(ans)


(n, m, k) = [int(x) for x in input().split()]
puzzle = list(map(int, input().split()))
ans = 0
cnt = 0
for x in puzzle:
	if x <= m:
		cnt = cnt + 1
	else:
		cnt = 0
	if cnt >= k:
		ans = ans + 1
print(ans)


(n, t, c) = map(int, input().split())
prisoners = list(map(int, input().split()))
res = 0
last = 0
current = 0
while current < n:
	if prisoners[current] > t:
		current += 1
		last = current
	else:
		moving = current - last + 1
		if moving == c:
			res += 1
			current += 1
			last += 1
		else:
			current += 1
print(res)


import sys
input = lambda : sys.stdin.readline()
int_arr = lambda : list(map(int, input().split()))
str_arr = lambda : list(map(str, input().split()))
get_str = lambda : map(str, input().split())
get_int = lambda : map(int, input().split())
get_flo = lambda : map(float, input().split())
mod = 1000000007

def solve(n, t, c, arr):
	cnt = 0
	i = 0
	ways = 0
	while i < n:
		if arr[i] > t:
			cnt = 0
		else:
			cnt += 1
		if cnt >= c:
			ways += 1
		i += 1
	print(ways)
(n, t, c) = get_int()
arr = int_arr()
solve(n, t, c, arr)


(n, t, c) = map(int, input().split())
a = list(map(int, input().split()))
a.insert(0, 0)
lst = [0 for _ in range(n + 1)]
for p in range(1, n + 1):
	if a[p] > t:
		lst[p] = p
	else:
		lst[p] = lst[p - 1]
ans = 0
for p in range(c, n + 1):
	if lst[p] <= p - c:
		ans += 1
print(ans)


n = input('')
(n, t, c) = n.split(' ')
line = input('')
line = line.split(' ')
line.append('1000000001')
ans = 0
start = 0
current = 0
for x in range(len(line)):
	if int(line[x]) > int(t):
		ans += max(0, x - start + 1 - int(c))
		start = x + 1
print(ans)


def validar(l, a):
	if len(l) < a:
		return 0
	else:
		return 1 + len(l) - a
n = input()
r = [int(x) for x in n.split(' ')]
n1 = input()
r1 = [int(x) for x in n1.split(' ')]
contador = 0
t = []
for k in range(0, len(r1)):
	if r1[k] <= r[1]:
		t.append(r1[k])
	else:
		contador += validar(t, r[2])
		t = []
contador += validar(t, r[2])
print(contador)


(n, t, c) = map(int, input().split())
prisoners = list(map(int, input().split()))
result = count = 0
for i in prisoners:
	if i > t:
		count = 0
	else:
		count += 1
		if count == c:
			count -= 1
			result += 1
if count == c:
	result += 1
print(result)


(n, t, c) = [int(i) for i in input().split()]
row = input().split()
aux = 0
sum = 0
for i in row:
	if t >= int(i):
		aux = aux + 1
	else:
		if c <= aux:
			sum += aux - (c - 1)
		aux = 0
if c <= aux:
	sum += aux - (c - 1)
print(sum)


(n, t, c) = map(int, input().split())
l = input().split()
counter = 0
i = 0
len_of_q = 0
while i < n:
	if int(l[i]) > t:
		len_of_q = 0
		i += 1
		continue
	i += 1
	len_of_q += 1
	if len_of_q >= c:
		counter += 1
print(counter)


from collections import deque
(n, t, c) = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
d = deque()
for i in range(c):
	while len(d) and a[i] >= a[d[-1]]:
		d.pop()
	d.append(i)
for i in range(c, n):
	if a[d[0]] <= t:
		ans += 1
	while len(d) and a[i] >= a[d[-1]]:
		d.pop()
	while len(d) and d[0] <= i - c:
		d.popleft()
	d.append(i)
if len(d) and a[d[0]] <= t:
	ans += 1
print(ans)


(n, t, c) = map(int, input().split())
a = list(map(int, input().split()))
b = 0
ans = 0
for i in range(n):
	if a[i] > t:
		ans += max(i - b - c + 1, 0)
		b = i + 1
ans += max(n - b - c + 1, 0)
print(ans)


from collections import deque

def solution(t, c, array):
	queue = deque([0], maxlen=c)
	for i in range(1, c):
		if len(queue) >= 1:
			while array[queue[-1]] <= array[i]:
				queue.pop()
				if len(queue) == 0:
					break
		queue.append(i)
	count = 1 if array[queue[0]] <= t else 0
	for i in range(c, len(array)):
		if i - queue[0] == c:
			queue.popleft()
		if len(queue) >= 1:
			while array[queue[-1]] <= array[i]:
				queue.pop()
				if len(queue) == 0:
					break
		queue.append(i)
		if array[queue[0]] <= t:
			count += 1
	return count

def main():
	(n, t, c) = map(int, input().split(' '))
	array = list(map(int, input().split(' ')))
	print(solution(t, c, array))
testing = False
if testing:
	from random import random
	n = 10
	for _ in range(10000):
		t = int(random() * 20) + 1
		c = int(random() * n) + 1
		a = [int(random() * 20) for _ in range(n)]
		solution(t, c, a)
else:
	main()


(n, t, c) = map(int, input().split())
k = r = 0
for i in input().split():
	k = k + 1 if int(i) <= t else 0
	r += k >= c
print(r)


(n, t, c) = map(int, input().split())
g = 0
data = []
for x in input().split():
	if int(x) > t:
		data.append(g)
	g += 1
if len(data) == 0:
	print(n - c + 1)
else:
	answer = 0
	for i in range(len(data) - 1, 0, -1):
		gg = data[i] - data[i - 1] - 1 - c + 1
		if gg > 0:
			answer += gg
	tz = data[0] - c + 1
	if tz > 0:
		answer += tz
	tz = n - 1 - data[-1] - c + 1
	if tz > 0:
		answer += tz
	print(answer)


import queue
(n, t, c) = map(int, input().split())
lista = list(map(int, input().split()))
maxpre = 0
cont = 0
for i in lista:
	if i > t:
		maxpre = 0
	elif maxpre < c:
		maxpre += 1
	if maxpre == c:
		cont += 1
print(cont)


from sys import stdin
(n, t, c) = map(int, stdin.readline().split())
cnt = 0
ct = 0
for i in map(int, stdin.readline().split()):
	if i <= t:
		ct = ct + 1
	else:
		if ct >= c:
			cnt = cnt + ct - c + 1
		ct = 0
if ct >= c:
	cnt = cnt + ct - c + 1
print(cnt)


(n, t, c) = map(int, input().split())
a = list(map(int, input().split()))
temp = c
total = 0
count = 0
for i in range(0, len(a)):
	if a[i] <= t:
		count += 1
	elif a[i] > t and count >= c:
		total += count - c + 1
		count = 0
	elif a[i] > t and count < c:
		count = 0
if count >= c:
	total += count - c + 1
print(total)


def main():
	(n, t, c) = map(int, input().split())
	crime_level = list(map(int, input().split()))
	lengths = []
	seg_len = 0
	for e in crime_level:
		if e <= t:
			seg_len += 1
		else:
			if seg_len >= c:
				lengths.append(seg_len)
			seg_len = 0
	if seg_len >= c:
		lengths.append(seg_len)
	ans = 0
	for e in lengths:
		ans += e - c + 1
	print(ans)
main()


(n, t, c) = (int(i) for i in input().split())
l = [int(i) for i in input().split()]
d = {1: []}
for i in range(n):
	if l[i] > t:
		d[1].append(i)
n1 = len(d[1])
if n1 == 0:
	print(n - c + 1)
else:
	ans = max(0, d[1][0] - c + 1)
	for i in range(n1 - 1):
		ans += max(0, d[1][i + 1] - d[1][i] - c)
	ans += max(0, n - d[1][n1 - 1] - c)
	print(ans)


(n, t, c) = map(int, input().strip().split())
l = list(map(int, input().strip().split()))
lastgreater = -1
res = 0
for i in range(0, n):
	if l[i] > t:
		lastgreater = i
	if i - lastgreater >= c:
		res += 1
print(res)


__author__ = 'Lipen'

def main():
	(n, t, c) = map(int, input().split())
	v = list(map(int, input().split()))
	k = 0
	answer = 0
	for i in range(n):
		x = v[i]
		if x > t:
			answer += max(0, k - c + 1)
			k = 0
		else:
			k += 1
	answer += max(0, k - c + 1)
	print(answer)
main()


import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *

class Scanner:

	@staticmethod
	def int():
		return int(sys.stdin.readline().rstrip())

	@staticmethod
	def string():
		return sys.stdin.readline().rstrip()

	@staticmethod
	def map_int():
		return [int(x) for x in Scanner.string().split()]

	@staticmethod
	def string_list(n):
		return [Scanner.string() for i in range(n)]

	@staticmethod
	def int_list_list(n):
		return [Scanner.map_int() for i in range(n)]

	@staticmethod
	def int_cols_list(n):
		return [Scanner.int() for i in range(n)]

class Math:

	@staticmethod
	def gcd(a, b):
		if b == 0:
			return a
		return Math.gcd(b, a % b)

	@staticmethod
	def lcm(a, b):
		return a * b // Math.gcd(a, b)

	@staticmethod
	def divisor(n):
		res = []
		i = 1
		for i in range(1, int(n ** 0.5) + 1):
			if n % i == 0:
				res.append(i)
				if i != n // i:
					res.append(n // i)
		return res

	@staticmethod
	def round_up(a, b):
		return -(-a // b)

	@staticmethod
	def is_prime(n):
		if n < 2:
			return False
		if n == 2:
			return True
		if n % 2 == 0:
			return False
		d = int(n ** 0.5) + 1
		for i in range(3, d + 1, 2):
			if n % i == 0:
				return False
		return True

def pop_count(x):
	x = x - (x >> 1 & 6148914691236517205)
	x = (x & 3689348814741910323) + (x >> 2 & 3689348814741910323)
	x = x + (x >> 4) & 1085102592571150095
	x = x + (x >> 8)
	x = x + (x >> 16)
	x = x + (x >> 32)
	return x & 127
MOD = int(1000000000.0) + 7
INF = int(1000000000000000.0)

def solve():
	(N, T, C) = Scanner.map_int()
	A = Scanner.map_int()
	ans = 0
	tmp = 0
	for a in A:
		if a > T:
			tmp = 0
		else:
			tmp += 1
			if tmp >= C:
				ans += 1
	print(ans)

def main():
	solve()
main()


from collections import deque
first = input()
(n, t, c) = first.split()
n = int(n)
t = int(t)
c = int(c)
second = input()
nums = [int(x) for x in second.split()]
d = deque()
count = 0
for i in range(n):
	if nums[i] <= t:
		d.append(nums[i])
	else:
		d.clear()
	if len(d) == c:
		count += 1
		d.popleft()
print(count)


import collections as cc
import sys
I = lambda : list(map(int, input().split()))
(n, m, c) = I()
l = I()
ans = 0
co = 0
for i in range(n):
	if l[i] > m:
		co = 0
		continue
	else:
		co += 1
		if co >= c:
			ans += 1
print(ans)


(n, t, c) = map(int, input().split())
pris = list(map(int, input().split()))
result = 0
trig = 0
for i in range(n):
	if pris[i] > t:
		trig = 0
	else:
		trig += 1
	if trig >= c:
		result += 1
print(result)


(n, t, c) = map(int, input().split())
s = [int(i) for i in input().split()]
cnt = 0
d = [-1]
for i in range(n):
	if s[i] > t:
		d.append(i)
d.append(n)
for i in range(len(d) - 1):
	a = d[i + 1] - d[i] - 1
	if a >= c:
		cnt += a - c + 1
print(cnt)


(n, t, c) = map(int, input().split())
a = list(map(int, input().split()))
l = []
k = []
for i in range(len(a)):
	if a[i] > t:
		k.append(l)
		l = []
	else:
		l.append(a[i])
k.append(l)
p = 0
for i in range(len(k)):
	if len(k[i]) - (c - 1) > 0:
		p += len(k[i]) - (c - 1)
print(p)


import sys
import math
import itertools
import functools
import collections
import operator
import fileinput
import copy
ORDA = 97

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	newnumber = 0
	while number > 0:
		newnumber += number % base
		number //= base
	return newnumber

def cdiv(n, k):
	return n // k + (n % k != 0)
(n, t, c) = mi()
a = li()
b = [0]
for i in range(n):
	if a[i] > t:
		b.append(i + 1)
b.append(n + 1)
ans = 0
for i in range(len(b) - 1):
	ans += max(0, b[i + 1] - b[i] - c)
print(ans)


(n, t, c) = [int(j) for j in input().split()]
p = [int(j) for j in input().split()]
p += [t + 1]
l = 0
s = 0
for i in range(n + 1):
	if p[i] <= t:
		l += 1
	elif l >= c:
		s += l - c + 1
		l = 0
	else:
		l = 0
print(s)


(n, a, b) = map(int, input().split())
l = list(map(int, input().split()))
k = 0
v = 0
for i in range(n):
	if l[i] <= a:
		v = v + 1
	else:
		if v - b >= 0:
			k = k + v - b + 1
		v = 0
if v - b >= 0:
	k = k + v - b + 1
print(k)


from sys import stdin
(n, t, c) = [int(i) for i in stdin.readline().split()]
prisioneros = [int(i) for i in stdin.readline().split()]
count = 0
ans = 0
for i in prisioneros:
	if i <= t:
		count += 1
	else:
		count = 0
	if count >= c:
		ans += 1
print(ans)


inp1 = [int(i) for i in input().split(' ')]
(n, t, c) = (inp1[0], inp1[1], inp1[2])
inp2 = [int(i) for i in input().split(' ')]
i = j = result = 0
while i < n:
	if inp2[i] <= t:
		i += 1
		j += 1
	else:
		if j >= c:
			if n == 1:
				result += j
			else:
				result += j - c + 1
		j = 0
		i += 1
	if j == n or (j == c and i == n):
		result += j - c + 1
print(result)


(n, t, c) = map(int, input().split())
l = list(map(int, input().split()))
curr = 0
ways = 0
for i in range(n):
	if l[i] <= t:
		curr += 1
		if curr == c:
			ways += 1
			curr -= 1
	else:
		curr = 0
print(ways)


(a, b, c) = map(int, input().split())
r = list(map(int, input().split()))
s = 0
t = 0
for i in range(a):
	if r[i] <= b:
		t += 1
		if t >= c:
			s += 1
	else:
		t = 0
print(s)


row = input().split()
row2 = input().split()
n = int(row[0])
t = int(row[1])
c = int(row[2])
aux = 0
cn = 0
for i in range(n):
	if int(row2[i]) <= t:
		cn += 1
	else:
		if cn >= c:
			aux = aux + cn - (c - 1)
		cn = 0
if cn >= c:
	aux = aux + cn - (c - 1)
print(aux)


(number, limit, chosen) = map(int, input().split())
prisioners = list(map(int, input().split()))
sequences = 0
aux = 0
for p in prisioners:
	if p > limit:
		aux = 0
	else:
		aux += 1
	if aux >= chosen:
		sequences += 1
print(sequences)


(n, t, c) = map(int, input().split())
arr = [int(i) for i in input().split()]
x = 0
y = 0
z = 0
for i in range(n):
	if arr[i] > t:
		z = i + 1
		if y - c + 1 > 0:
			x = x + (y - c + 1)
		y = 0
	else:
		y = y + 1
if n - z - c + 1 > 0:
	x = x + (n - z - c + 1)
if x < 0:
	print(0)
else:
	print(x)


(n, t, c) = map(int, input().split())
arr = list(map(int, input().split()))
num_pris = 0
Max = -1
is_pos = True
Bool = [True for i in range(n)]
dp = [True for i in range(n - c + 2)]
for i in range(n):
	if arr[i] > t:
		Bool[i] = False
for i in range(c):
	if Bool[i] is False:
		dp[1] = False
		Max = i
for k in range(c, n):
	if Bool[k] is False:
		Max = k
		dp[k - c + 2] = False
	elif Max > k - c:
		dp[k - c + 2] = False
for i in range(1, len(dp)):
	boo = dp[i]
	if boo:
		num_pris += 1
print(num_pris)


(n, t, c) = map(int, input().split())
l_p = list(map(int, input().split()))
t_c = 0
i = 0
c_l = 0
while i < n:
	if l_p[i] <= t:
		c_l += 1
	else:
		c_l = 0
	if c_l >= c:
		t_c += 1
	i += 1
print(t_c)


(n, t, c) = [int(i) for i in input().split()]
result = 0
danger = -1
for (i, v) in enumerate((int(i) for i in input().split())):
	if v > t:
		danger = i
	elif i - danger >= c:
		result += 1
print(result)


(n, t, c) = list(map(int, input().split()))
arr = list(map(int, input().split()))
count = 0
start = 0
for i in range(1, n):
	if arr[i] > t:
		count += max(i - start - c + 1, 0)
		start = i + 1
if arr[n - 1] <= t:
	count += max(n - start - c + 1, 0)
print(count)


(a, b, c) = map(int, input().split())
l = list(map(int, input().split()))
ans = []
for i in range(len(l)):
	if l[i] <= b:
		ans.append(True)
	else:
		ans.append(False)
d = []
base = 0
for i in range(len(ans)):
	if ans[i] == True:
		base = base + 1
	elif ans[i] == False:
		d.append(base)
		base = 0
	if i == len(ans) - 1:
		d.append(base)
e = sum([i - (c - 1) for i in d if i >= c])
print(e)


(n, t, c) = (int(X) for X in input().split())
L = [int(X) for X in input().split()]
a = -1
A = []
for i in range(n):
	if L[i] <= t:
		if a == -1:
			if c == 1 and i == n - 1:
				A.append(1)
			else:
				a = i
		elif i == n - 1 and n - a - c + 1 > 0:
			A.append(n - a - c + 1)
	elif a != -1:
		if i - a - c + 1 > 0:
			A.append(i - a - c + 1)
		a = -1
print(sum(A))


from collections import deque
(n, t, c) = map(int, input().split())
prisoners = list(map(int, input().split()))
q = deque()
i = 0
count = 0
while i < n:
	p = prisoners[i]
	if len(q) < c:
		if p > t:
			q = deque()
		else:
			q.append(prisoners[i])
	if len(q) == c:
		count += 1
		q.popleft()
	i += 1
print(count)


(n, t, c) = map(int, input().split())
sv = list(map(int, input().split()))
cnt = 0
ans = 0
for i in range(n):
	if sv[i] <= t:
		cnt += 1
		if cnt >= c:
			ans += 1
	else:
		cnt = 0
print(ans)


(n, t, c) = list(map(int, input().split()))
l = list(map(int, input().split()))
i = 0
y = 0
j = 0
p = []
while i < len(l):
	if l[i] > t:
		p.append(i)
	i += 1
k = 0
for j in p:
	r = j - k
	if r >= c:
		y += r - c + 1
	else:
		y += 0
	k = j + 1
if len(p) == 0:
	if n >= c:
		y += n - c + 1
	else:
		y += 0
else:
	r = n - j - 1
	if r >= c:
		y += r - c + 1
	else:
		y += 0
print(y)


(N, T, C) = map(int, input().split())
pics = [-1]
for (index, s) in enumerate(map(int, input().split())):
	if s > T:
		pics.append(index)
pics.append(N)
ans = 0
for (picIndex, pic) in enumerate(pics):
	diff = pic - pics[picIndex - 1] - 1
	ans += max(diff - C + 1, 0)
print(ans)


(n, t, k) = map(int, input().split())
l = list(map(int, input().split()))
r = [-1]
for i in range(n):
	if l[i] > t:
		r.append(i)
ans = 0
r.append(n)
for i in range(len(r)):
	diff = r[i] - r[i - 1] - 1
	ans += max(diff - k + 1, 0)
print(ans)


(n, t, c) = map(int, input().split())
l = list(map(int, input().split()))
(ans, tp) = (0, 0)
for i in range(n):
	if l[i] > t:
		l1 = i - tp
		ans += max(0, l1 - c + 1)
		tp = i + 1
i += 1
l1 = i - tp
ans += max(0, l1 - c + 1)
print(ans)


(n, t, c) = [int(c) for c in input().split()]
cruelty = [int(c) for c in input().split()]
res = 0
current_length = 0
for i in cruelty:
	if i <= t:
		current_length += 1
	else:
		if current_length >= c:
			res += current_length - c + 1
		current_length = 0
if current_length >= c:
	res += current_length - c + 1
print(res)


from os import path
import sys
from heapq import heappush, heappop
from functools import cmp_to_key as ctk
from collections import deque, defaultdict as dd
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from itertools import permutations
from datetime import datetime
from math import ceil, sqrt, log, gcd

def ii():
	return int(input())

def si():
	return input().rstrip()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def bo(i):
	return ord(i) - ord('0')
file = 1

def solve():
	(n, t, s) = mi()
	a = li()
	c = 0
	s -= 1
	ans = 0
	for x in a:
		if x > t:
			if c >= s:
				ans += c - s
			c = 0
		else:
			c += 1
	if c >= s:
		ans += c - s
	print(ans)
if file:
	if path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	else:
		input = sys.stdin.readline
solve()


(n, t, c) = map(int, input().split())
arr = list(map(int, input().split()))
(i, j, res) = (0, 0, 0)
while i < n:
	while i < n and arr[i] <= t:
		i += 1
	r = i - j
	if r >= c:
		res += r - c + 1
	i += 1
	j = i
print(res)


r = lambda : map(int, input().split())
(n, t, c) = r()
last = -1
p = list(r())
total = 0
for (i, x) in enumerate(p):
	if x > t:
		last = i
		continue
	if i >= last + c:
		total += 1
print(total)


from sys import stdin
input = lambda : stdin.readline().strip()
from math import ceil, sqrt, factorial
INT_MIN = float('-infinity')
INT_MAX = float('infinity')
(n, t, c) = map(int, input().split())
l = list(map(int, input().split()))
z = [-1]
for i in range(n):
	if l[i] > t:
		z.append(i)
z.append(n)
ans = 0
for i in range(1, len(z)):
	if z[i] - z[i - 1] - 1 >= c:
		ans += z[i] - z[i - 1] - 1 - c + 1
print(ans)


l1 = input().split(' ')
n = int(l1[0])
t = int(l1[1])
c = int(l1[2])
ways = 0
arr = []
l2 = input().split(' ')
for a in l2:
	arr.append(int(a))
cut = [0]
for j in range(len(arr)):
	sever = arr[j]
	if sever > t:
		cut.append(j)
cut.append(len(arr) - 1)
import math
if len(cut) == 2:
	if len(arr) >= c:
		ways += len(arr) - c + 1
	else:
		ways = 0
else:
	for d in range(len(cut) - 1):
		ele1 = cut[d]
		ele2 = cut[d + 1]
		if d == 0 or d == len(cut) - 2:
			if ele2 - ele1 >= c:
				ways += ele2 - ele1 - c + 1
		else:
			diff = ele2 - ele1 - 1
			if diff >= c:
				ways += diff - c + 1
print(ways)


(n, t, c) = map(int, input().split())
a = list(map(int, input().split()))
p = []
k = 0
i = 0
while i < n:
	if a[i] > t:
		b = a[k:i]
		if len(b) > 0:
			p.append(b)
		k = i + 1
	i += 1
b = a[k:n]
if len(b) > 0:
	p.append(b)
f = 0
for i in p:
	if len(i) >= c:
		f += len(i) - c + 1
print(f)


(n, t, c) = map(int, input().split())
m = 0
j = 0
for i in map(int, input().split()):
	if i <= t:
		j += 1
	else:
		if j >= c:
			m += j - c + 1
		j = 0
if j >= c:
	m += j - c + 1
print(m)


(n, t, c) = [int(i) for i in input().split()]
array = [int(i) if int(i) <= t else '@' for i in input().split()]
count = 0
soma = 0
array.append('@')
for i in array:
	if i == '@':
		if count >= c:
			soma += count - c + 1
		count = 0
	else:
		count += 1
print(soma)


(n, t, c) = [int(i) for i in input().split()]
ls = [int(i) for i in input().split()]
ans = 0
i = 0
count = 0
while i < n:
	if ls[i] <= t:
		count += 1
	else:
		count = 0
	if count == c:
		ans += 1
		count -= 1
	i += 1
print(ans)


def solve(arr, t, c):
	if c == 0:
		return 0
	if t == 0:
		return 0
	count = 0
	ans = 0
	for i in range(len(arr)):
		if arr[i] <= t:
			count += 1
		else:
			if count >= c:
				ans += count - c + 1
			count = 0
	if count >= c:
		ans += count - c + 1
	return ans
(n, t, c) = map(int, input().split())
arr = list(map(int, input().split()))
print(solve(arr, t, c))


(totalPrisioneiros, limiteCrime, quantidadePrisioneiros) = [int(x) for x in input().split()]
listaPrisioneiros = [int(x) for x in input().split()]
listaContinua = []
contador = 0
for i in listaPrisioneiros:
	if i > limiteCrime:
		if contador > 0:
			listaContinua.append(contador)
		contador = 0
	else:
		contador += 1
else:
	if contador > 0:
		listaContinua.append(contador)
contador = 0
for i in listaContinua:
	if i >= quantidadePrisioneiros:
		contador += i - quantidadePrisioneiros + 1
print(contador)


(n, t, c) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
k = 0
p = 0
i = 0
for i in a:
	if i <= t:
		p += 1
	else:
		if p >= c:
			k += p - c + 1
		p = 0
if p >= c:
	k += p - c + 1
print(k)


a = list(map(int, input().split()[1:]))
b = list(map(int, input().split()))
m = 0
c = 0
for i in b:
	if i > a[0]:
		if not c < a[1]:
			m += c - a[1] + 1
		c = 0
	else:
		c += 1
print(m + c - a[1] + 1 if c >= a[1] else m)


from sys import stdin, stdout
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque
from heapq import merge, heapify, heappop, heappush, nsmallest
from bisect import bisect_left as bl, bisect_right as br, bisect
mod = pow(10, 9) + 7
mod2 = 998244353

def inp():
	return stdin.readline().strip()

def iinp():
	return int(inp())

def out(var, end='\n'):
	stdout.write(str(var) + '\n')

def outa(*var, end='\n'):
	stdout.write(' '.join(map(str, var)) + end)

def lmp():
	return list(mp())

def mp():
	return map(int, inp().split())

def smp():
	return map(str, inp().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(m, val) for j in range(n)]

def remadd(x, y):
	return 1 if x % y else 0

def ceil(a, b):
	return (a + b - 1) // b
S1 = 'abcdefghijklmnopqrstuvwxyz'
S2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

def isprime(x):
	if x <= 1:
		return False
	if x in (2, 3):
		return True
	if x % 2 == 0:
		return False
	for i in range(3, int(sqrt(x)) + 1, 2):
		if x % i == 0:
			return False
	return True
(n, t, c) = mp()
arr = lmp()
inds = [-1]
for i in range(n):
	if arr[i] > t:
		inds.append(i)
inds.append(n)
ans = 0
for i in range(1, len(inds)):
	ans += max(0, inds[i] - inds[i - 1] - c)
print(ans)


(n, t, c) = map(int, input().strip().split())
a = list(map(int, input().strip().split()))
count = 0
op = 0
for i in a:
	if i > t:
		if count >= c:
			op = op + count - c + 1
		count = 0
	else:
		count = count + 1
if count >= c:
	op = op + count - c + 1
print(op)


(n, t, c) = map(int, input().split())
(res, cnt) = (0, 0)
for el in map(int, input().split()):
	if el > t:
		res += max(0, cnt - c + 1)
		cnt = 0
	else:
		cnt += 1
print(res + max(0, cnt - c + 1))


(X, Severity, Count) = (list(map(int, input().split())), list(map(int, input().split())), 0)
i = 0
Counter = 0
while i < X[0]:
	if Severity[i] > X[1]:
		Count += max(0, Counter - X[2] + 1)
		Counter = 0
	else:
		Counter += 1
	i += 1
Count += max(0, Counter - X[2] + 1)
print(Count)


a = []
a.append(-1)
(n, t, c) = map(int, input().split())
b = [int(i) for i in input().split()]
for i in range(n):
	if b[i] > t:
		a.append(i)
a.append(n)
ans = 0
for i in range(len(a) - 1):
	if a[i + 1] - a[i] - 1 >= c:
		ans += a[i + 1] - a[i] - c
print(ans)


def lmap():
	return list(map(int, input().split()))
(n, t, c) = map(int, input().split())
w = lmap()
w.append(t + 1)
ans = []
cpr = 0
prs = 0
flg = 0
for i in range(n + 1):
	if w[i] <= t:
		cpr += 1
	elif w[i] > t:
		flg = 1
		if cpr < c:
			cpr = 0
		else:
			prs += cpr - (c - 1)
			cpr = 0
if flg == 0:
	print(cpr - (c - 1))
else:
	print(prs)


(n, t, c) = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
s = 0
for i in a:
	if i <= t:
		s += 1
	elif i > t and s >= c:
		ans += s - c + 1
		s = 0
	elif i > t and s < c:
		s = 0
if s >= c:
	ans += s - c + 1
print(ans)


s = 0
ans = 0
(n, t, c) = map(int, input().split())
for i in map(int, input().split()):
	if i <= t:
		s += 1
	else:
		s = 0
	if s >= c:
		ans += 1
print(ans)


(n, t, c) = [int(i) for i in input().split()]
s = [int(i) for i in input().split()]
k = 0
num = 0
for i in s:
	if i <= t:
		k += 1
		if k >= c:
			num += 1
	else:
		k = 0
print(num)


fast = lambda : stdin.readline().strip()
zzz = lambda : [int(i) for i in fast().split()]
(z, zz) = (input, lambda : list(map(int, z().split())))
(szz, graph, mod, szzz) = (lambda : sorted(zz()), {}, 10 ** 9 + 7, lambda : sorted(zzz()))
from re import *
from sys import *
from math import *
from heapq import *
from queue import *
from bisect import *
from string import *
from itertools import *
from collections import *
from math import factorial as f
from bisect import bisect as bs
from bisect import bisect_left as bsl
from collections import Counter as cc
from itertools import accumulate as ac

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def prime(x):
	p = ceil(x ** 0.5) + 1
	for i in range(2, p):
		if x % i == 0 and x != 2 or x == 0:
			return 0
	return 1

def dfs(u, visit, graph):
	visit[u] = 1
	for i in graph[u]:
		if not visit[i]:
			dfs(i, visit, graph)

def output(answer):
	stdout.write(str(answer))
(n, t, c) = zzz()
arr = zzz()
s = 0
ans = 0
for i in range(n):
	if arr[i] <= t:
		s += 1
		if s >= c:
			ans += 1
		else:
			pass
	else:
		s = 0
print(ans)


(n, t, c) = map(int, input().split())
a = list(map(int, input().split()))
count = 0
vis = []
vis.append(-1)
for i in range(n):
	if a[i] > t:
		vis.append(i)
vis.append(n)
count = 0
for i in range(1, len(vis)):
	diff = vis[i] - vis[i - 1] - 1
	count += max(diff - c + 1, 0)
print(count)


(n, t, c) = map(int, input().split())
vals = list(map(int, input().split()))
counter = 0
i = 0
mini = c - 1
while i < n:
	if vals[i] > t:
		mini = i + c
	if i >= mini:
		counter += 1
	i += 1
print(counter)


(n, limit, janela) = input().split()
n = int(n)
limit = int(limit)
janela = int(janela)
presos = [*map(int, input().split())]
count = 0
i = 0
acc = 0
while i < n:
	if presos[i] <= limit:
		acc += 1
		i += 1
		if acc >= janela:
			count += 1
	else:
		acc = 0
		i += 1
print(count)


(n, t, c) = map(int, input().split())
arr = list(map(int, input().split()))
ans = []
temp = []
for i in arr:
	if i <= t:
		temp.append(i)
	else:
		ans.append(temp[:])
		temp = []
if temp:
	ans.append(temp)
out = 0
for i in ans:
	if len(i) >= c:
		out += len(i) - c + 1
print(out)


(presos, crime_maximo, tamanho_maximo) = map(int, input().split())
crimes = map(int, input().split())
(possiveis, fila_atual) = (0, 0)
for crime in crimes:
	if crime <= crime_maximo:
		fila_atual += 1
		if fila_atual >= tamanho_maximo:
			possiveis += 1
	else:
		fila_atual = 0
print(possiveis)


(n, t, c) = map(int, input().split())
pri = list(map(int, input().split())) + [t + 1]
ans = 0
aux = 0
for p in pri:
	if p <= t:
		aux += 1
	else:
		if aux >= c:
			ans += aux - (c - 1)
		aux = 0
print(ans)


(n, t, c) = map(int, input().split())
a = list(map(int, input().split()))
for i in range(n):
	if a[i] > t:
		a[i] == 1
	else:
		a[i] = 0
now = sum(a[0:c])
cou = 0
if now == 0:
	cou += 1
for i in range(1, n - c + 1):
	now -= a[i - 1]
	now += a[i + c - 1]
	if now == 0:
		cou += 1
print(cou)


(n, t, c) = [int(x) for x in input().split()]
array = [int(x) for x in input().split()]
if n < c:
	print(0)
else:
	ini = 0
	fim = 0
	count = 0
	while fim < n:
		if array[fim] > t:
			ini = fim + 1
		if fim - ini + 1 >= c:
			count += 1
		fim += 1
	print(count)


(n, t, c) = [int(x) for x in input().split()]
l = [int(x) for x in input().split()]
cnt = 0
ans = 0
for x in l:
	if x <= t:
		cnt += 1
	else:
		cnt = 0
	if cnt >= c:
		ans += 1
print(ans)


(n, t, c) = map(int, input().split())
v = list(map(int, input().split()))
f = []
cont1 = 0
conTot = 0
for i in range(n):
	if v[i] <= t:
		cont1 += 1
	else:
		cont1 = 0
	if cont1 >= c:
		conTot += 1
print(conTot)


(n, t, c) = map(int, input().split())
nivelCrime = list(map(int, input().split()))
cnt = 0
ansFinal = 0
for i in nivelCrime:
	if i <= t:
		cnt += 1
		if cnt >= c:
			ansFinal += 1
	else:
		cnt = 0
print(ansFinal)


import math
from decimal import *
(n, t, c) = map(int, input().split())
arr = list(map(int, input().split()))
cnt = 0
ans = 0
for i in range(n):
	if arr[i] <= t:
		cnt += 1
	else:
		if cnt >= c:
			ans += cnt - c + 1
		cnt = 0
if cnt >= c:
	ans += cnt - c + 1
print(ans)


def solution(t, c, P):
	cons = ret = 0
	for p in P:
		if p <= t:
			cons += 1
		else:
			cons = 0
		if c <= cons:
			ret += 1
	return ret
(n, t, c) = map(int, input().split())
P = map(int, input().split())
print(solution(t, c, P))


R = lambda : map(int, input().split())
(n, t, c) = R()
a = list(R())
gt = 0
for i in range(c):
	if a[i] > t:
		gt += 1
ans = 0
a.append(0)
for i in range(n - c + 1):
	if gt == 0:
		ans += 1
	if a[i] > t:
		gt -= 1
	if a[i + c] > t:
		gt += 1
print(ans)


(n, t, c) = [int(x) for x in input().split()]
ex_id = [-1] + [i for (i, v) in enumerate(input().split()) if int(v) > t] + [n]
ans = 0
for i in range(1, len(ex_id)):
	diff = ex_id[i] - ex_id[i - 1] - 1
	ans += max(diff - c + 1, 0)
print(ans)


def main():
	(n, t, c) = map(int, input().split())
	a = b = 0
	for x in map(int, input().split()):
		if x <= t:
			b += 1
			a += b >= c
		else:
			b = 0
	print(a)
main()


cnt = lambda s, x: s.count(x)
ii = lambda : int(input())
si = lambda : input()
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
(n, t, c) = f()
l = il()
ct = 0
k = 0
for i in l:
	if i <= t:
		k += 1
		if k == c:
			ct += 1
			k -= 1
	else:
		k = 0
print(ct)


import sys, threading, os.path
import string
import collections, heapq, math, bisect
sys.setrecursionlimit(10 ** 6)
threading.stack_size(2 ** 27)

def main():
	if os.path.exists('in.txt'):
		input = open('in.txt', 'r')
	else:
		input = sys.stdin
	(n, t, c) = list(map(int, input.readline().split()))
	lis = list(map(int, input.readline().split()))
	(segment, count) = (0, 0)
	for i in range(len(lis)):
		if lis[i] > t:
			segment = 0
		elif lis[i] <= t and segment < c:
			segment += 1
		if segment == c and lis[i] <= t:
			count += 1
	output = count
	if os.path.exists('out.txt'):
		open('out.txt', 'w').writelines(str(output))
	else:
		sys.stdout.write(str(output))
main()


import sys
f = sys.stdin
(n, t, c) = map(int, f.readline().split())
s = f.readline().split()
total = 0
r = 0
for j in s:
	d = int(j)
	if d <= t:
		r += 1
	else:
		if r >= c:
			total += r - c + 1
		r = 0
if r >= c:
	total += r - c + 1
print(str(total))


from collections import Counter
(n, t, c) = map(int, input().split())
l = list(map(int, input().split()))
k = 0
count = 0
for i in range(len(l)):
	if l[i] <= t:
		k = k + 1
	else:
		k = 0
	if k == c:
		count = count + 1
		k = c - 1
print(count)


(n, t, c) = [int(i) for i in input().split()]
ps = [int(i) for i in input().split()]
count = 0
res = 0
for p in ps:
	if p > t:
		if count >= c:
			res += count - c + 1
		count = 0
	else:
		count += 1
if count >= c:
	res += count - c + 1
print(res)


(n, t, k) = map(int, input().split())
s = [int(i) for i in input().split()]
c = 0
i = 0
d = 0
while d < n:
	g = s[d]
	if g <= t:
		c += 1
	if g > t or d == n - 1:
		if c >= k:
			i += c - (k - 1)
			c = 0
			b = []
		else:
			c = 0
	d = d + 1
print(i)


(a, b, c) = map(int, input().split())
l = [int(s) for s in input().split()]
l1 = []
c1 = 0
for i in range(a):
	if l[i] <= b:
		l1.append(l[i])
	else:
		if len(l1) >= c:
			c1 += len(l1) - c + 1
		l1 = []
if len(l1) >= c:
	c1 += len(l1) + 1 - c
print(c1)


from sys import stdin, stdout
(n, t, c) = map(int, stdin.readline().split())
arr = [int(i) for i in stdin.readline().split()]
i = 0
l = 0
ans = 0
while i < len(arr):
	if arr[i] <= t:
		l += 1
	else:
		ans += max(l - c + 1, 0)
		l = 0
	i += 1
ans += max(l - c + 1, 0)
stdout.write(str(ans))


(n, t, c) = [int(x) for x in input().split()]
p = [int(x) for x in input().split()]
ch = []
count = 0
res = 0
for i in range(len(p)):
	if p[i] <= t:
		count += 1
		if count == c:
			res += 1
			count = c - 1
	else:
		count = 0
print(res)


(n, t, c) = map(int, input().split())
z = list(map(int, input().split()))
a = b = r = 0
while b < len(z):
	if z[b] > t:
		p = b - a - c + 1
		r += p if p > 0 else 0
		a = b + 1
	b += 1
p = b - a - c + 1
r += p if p > 0 else 0
print(r)


(n, t, c) = map(int, input().split())
l = list(map(int, input().split())) + [t + 1]
foo = 0
q = 0
for i in l:
	if i <= t:
		q += 1
	else:
		if q + 1 > c:
			foo += q - (c - 1)
		q = 0
print(foo)


(n, t, c) = map(int, input().split())
criminals = list(map(int, input().split()))
ways = 0
lo = 0
hi = 0
while hi < n:
	if criminals[hi] > t:
		hi += 1
		lo = hi
		continue
	if hi - lo + 1 < c:
		hi += 1
	else:
		lo += 1
		hi += 1
		ways += 1
print(ways)


(n, t, c) = map(int, input().split())
l = list(map(int, input().split()))
ce = 0
cc = []
for x in l:
	if x > t:
		cc.append(ce)
		ce = 0
	else:
		ce += 1
cc.append(ce)
to = 0
for x in cc:
	if x >= c:
		to += x - c + 1
print(to)


(n, t, c) = map(int, input().split())
a = list(map(int, input().split()))
M = 0
res = n - c + 1
end_index = n - c
last = -float('inf')
for i in range(n):
	if a[i] > t:
		start = max(i - (c - 1), 0)
		end = min((end_index, i))
		start = max(last + 1, start)
		last = i
		yy = end - start + 1
		if yy > 0:
			res -= yy
print(res)


(n, t, c) = input().split()
n = int(n)
t = int(t)
c = int(c)
p = input().split(' ')
for i in range(n):
	p[i] = int(p[i])
parts = []
ans = 0
last = -1
for i in range(n):
	if p[i] > t:
		parts.append(i - last - 1)
		last = i
parts.append(len(p) - last - 1)
for i in parts:
	possibilities = i - c + 1
	if possibilities > 0:
		ans = ans + possibilities
print(ans)


n_t_c = input()
input_list = n_t_c.split()
total_prisoners = int(input_list[0])
max_crime_level = int(input_list[1])
transfer_prisoners = int(input_list[2])
crime_levels = input()
crime_levels = crime_levels.split()
for i in range(len(crime_levels)):
	crime_levels[i] = int(crime_levels[i])
number_of_ways = 0
i = 0
initial_index = 0
while i < total_prisoners:
	if crime_levels[i] > max_crime_level:
		number_of_ways += max(i - initial_index - transfer_prisoners + 1, 0)
		initial_index = i + 1
	if i == total_prisoners - 1 and crime_levels[i] <= max_crime_level:
		number_of_ways += max(i - initial_index - transfer_prisoners + 2, 0)
	i += 1
print(number_of_ways)


(n, t, c) = map(int, input().split())
ans = 0
l = list(map(int, input().split()))
i = 0
while i < n:
	j = i
	cnt = 0
	while j < n and l[j] <= t:
		j += 1
		cnt += 1
		i = j
	if cnt >= c:
		ans += cnt - c + 1
	i += 1
print(ans)


(n, t, c) = list(map(int, input().split(' ')))
severity = list(map(int, input().split(' ')))
total = ini = 0
subsets = []
severity.append(10000000000)
for i in range(len(severity)):
	if severity[i] > t:
		subsets.append(severity[ini:i])
		ini = i + 1
if len(subsets) == 0:
	subsets.append(severity)
for i in subsets:
	if len(i) - c + 1 > 0:
		total += len(i) - c + 1
print(total)


need_log = False

def log(*s):
	if need_log:
		print(*s)
(n, t, c) = map(int, input().split())
a = list(map(int, input().split()))
if c == 0:
	print(0)
	return
g = []
k = 0
for i in a:
	if i <= t:
		k += 1
	elif k > 0:
		g += [k]
		k = 0
if k > 0:
	g += [k]
log(g)
result = 0
for i in g:
	result += max(i - c + 1, 0)
print(result)


(n, t, c) = map(int, input().split())
ways = group = 0
for crime_level in map(int, input().split()):
	if crime_level > t:
		(ways, group) = (ways + max(0, group - c + 1), 0)
	else:
		group += 1
print(ways + max(0, group - c + 1))


class InputHandlerObject(object):
	inputs = []

	def getInput(self, n=0):
		res = ''
		inputs = self.inputs
		if not inputs:
			inputs.extend(input().split(' '))
		if n == 0:
			res = inputs[:]
			inputs[:] = []
		while n > len(inputs):
			inputs.extend(input().split(' '))
		if n > 0:
			res = inputs[:n]
			inputs[:n] = []
		return res
InputHandler = InputHandlerObject()
g = InputHandler.getInput
(n, t, c) = [int(x) for x in g()]
a = [False if int(x) > t else True for x in g()]
ct = 0
res = 0
for i in a:
	if i:
		ct += 1
		if ct >= c:
			res += 1
	else:
		ct = 0
print(res)


def main():
	(n, t, c) = [int(c) for c in input().split()]
	s = [int(c) for c in input().split()] + [t + 1]
	cnt = res = 0
	for e in s:
		if e <= t:
			cnt += 1
		else:
			if cnt >= c:
				res += cnt - c + 1
			cnt = 0
	print(res)
main()


(n, t, c) = [int(x) for x in input().split()]
arr = [int(x) for x in input().split()]
ways = 0
temp = []
for i in arr:
	if i <= t:
		temp.append(i)
	else:
		if len(temp) >= c:
			ways += len(temp) - c + 1
		temp.clear()
if len(temp) >= c:
	ways += len(temp) - c + 1
	temp.clear()
print(ways)


(n, t, c) = map(int, input().split())
C = list(map(int, input().split()))
k = 0
r = 0
for i in range(n):
	if C[i] <= t:
		k += 1
	else:
		r += max(0, k - c + 1)
		k = 0
print(r + max(0, k - c + 1))


(n, t, c) = map(int, input().split())
A = map(int, input().split())
B = [0]
for i in A:
	if i > t and B[-1] != 0:
		B.append(0)
	elif i <= t:
		B[-1] += 1
res = 0
for i in B:
	res += 0 if i - c + 1 < 0 else i - c + 1
print(res)


(n, t, c) = [int(x) for x in input().split()]
prisoners = [int(x) for x in input().split()]
total = 0
current = 0
for i in prisoners:
	if i > t:
		if current >= c:
			total += current - c + 1
		current = 0
	else:
		current += 1
if current >= c:
	total += current - c + 1
print(total)


(n, t, c) = input().split(' ')
arr = input().split(' ')
(n, t, c) = (int(n), int(t), int(c))
arr = [int(x) for x in arr]
(start, end, count) = (0, 0, 0)
while start < n:
	if arr[start] <= t:
		while end < n and arr[end] <= t:
			end += 1
		count += max(end - start - c + 1, 0)
		(start, end) = (end, end)
	else:
		(start, end) = (start + 1, start + 1)
print(count)


(n, t, c) = map(int, input().split())
b = 0
count = 0
for x in map(int, input().split()):
	if x <= t:
		b += 1
	else:
		b = 0
	if b >= c:
		count += 1
print(count)


(n, k, c) = map(int, input().split())
ans = v = 0
for i in input().split():
	if int(i) > k:
		v = 0
	else:
		v += 1
	if v >= c:
		ans += 1
print(ans)


(n, t, c) = list(map(int, input().split()))
presos = list(map(int, input().split()))
temp = 0
temp2 = 0
for e in presos:
	if e <= t:
		temp += 1
	else:
		if temp >= c:
			temp2 += temp - c + 1
		temp = 0
else:
	if temp >= c:
		temp2 += temp - c + 1
print(temp2)


(n, t, c) = map(int, input().split())
x = list(map(int, input().split()))
ans = 0
cnt = 0
for i in range(n):
	if x[i] <= t:
		cnt += 1
	if x[i] > t or i == n - 1:
		if cnt >= c:
			ans += cnt - c + 1
		cnt = 0
print(ans)


(n, t, c) = map(int, input().split())
v = [-1]
for (i, j) in enumerate(input().split()):
	temp = int(j)
	if temp > t:
		v.append(i)
v.append(n)
ans = 0
for i in range(1, len(v)):
	diff = v[i] - v[i - 1] - 1
	ans += max(diff - c + 1, 0)
print(ans)


import bisect
import collections
import copy
import functools
import heapq
import itertools
import math
import random
import re
import sys
import time
import string
from typing import List
sys.setrecursionlimit(99999)
(n, t, c) = map(int, sys.stdin.readline().split())
l = 0
ans = 0
for nt in map(int, sys.stdin.readline().split()):
	if nt > t:
		l = 0
	else:
		l += 1
	ans += l >= c
print(ans)


(n, t, c) = list(map(int, input().split()))
a = list(map(int, input().split()))
(i, p, l) = (0, 0, 0)
while i < c:
	if a[i] > t:
		p += 1
	i += 1
if p == 0:
	l += 1
while i < n:
	if a[i] > t:
		p += 1
	if a[i - c] > t:
		p -= 1
	if p == 0:
		l += 1
	i += 1
print(l)


string = input().split()
n = int(string[0])
t = int(string[1])
c = int(string[2])
a = list(map(int, input().split()))
kol = 0
for i in range(c):
	if a[i] > t:
		kol += 1
if kol == 0:
	ans = 1
else:
	ans = 0
for i in range(c, n):
	if a[i - c] > t:
		kol -= 1
	if a[i] > t:
		kol += 1
	if kol == 0:
		ans += 1
print(ans)


MP = lambda : map(int, input().split())
(n, t, c) = MP()
severity = list(MP()) + [float('infinity')]
(l, a) = (0, 0)
for s in severity:
	if s > t:
		a += max(l - c + 1, 0)
		l = 0
	else:
		l += 1
print(a)


(n, t, c) = map(int, input().split())
a = list(map(int, input().split()))
a.append(t + 1)
ans = 0
curr = 0
for i in a:
	if i <= t:
		curr += 1
	else:
		if curr >= c:
			ans += curr - c + 1
		curr = 0
print(ans)


(n, t, c) = map(int, input().split())
line = list(map(int, input().split()))
line.append(t + 1)
num = res = 0
for i in range(n + 1):
	if line[i] > t:
		if num >= c:
			res += 1 + num - c
		num = 0
	else:
		num += 1
print(res)


R = lambda : list(map(int, input().split()))
(n, t, c) = R()
a = R()
isStart = True
i = 0
ans = 0
while i < n:
	if isStart and i <= n - c:
		j = i
		while j <= i + c - 1:
			if a[j] > t:
				break
			j += 1
		if j > i + c - 1:
			isStart = False
			ans += 1
			i += c - 1
		else:
			isStart = True
			i = j
	elif not isStart:
		if a[i] <= t:
			ans += 1
			isStart = False
		else:
			isStart = True
	i += 1
print(ans)


(n, t, c) = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
for i in range(n):
	if a[i] > t:
		a[i] = ' '
	else:
		a[i] = 'G'
s = ''.join(a).split()
for i in s:
	ans += max(0, len(i) - c + 1)
print(ans)


(n, t, c) = map(int, input().split())
list1 = list(map(int, input().split()))
lst = []
sum1 = 0
for i in range(n):
	if list1[i] <= t:
		lst.append(list1[i])
	elif len(lst) >= c:
		sum1 += len(lst) - c + 1
		lst = []
	else:
		lst = []
if len(lst) >= c:
	sum1 += len(lst) - c + 1
print(sum1)


(_, t, c) = tuple(map(int, str.split(input())))
index = -1
count = 0
for (i, ct) in enumerate(map(int, str.split(input()))):
	if ct > t:
		index = i
	elif i - index >= c:
		count += 1
print(count)


(n, t, c) = map(int, input().split())
p = list(map(int, input().split()))
g = []
a = -1
for i in range(n):
	if p[i] > t:
		g.append(i - a - 1)
		a = i
g.append(n - a - 1)
w = 0
for i in g:
	if i >= c:
		w += i - c + 1
print(w)


(n, t, c) = map(int, input().split())
p = list(map(int, input().split()))
pCount = count = 0
for i in range(len(p)):
	if p[i] > t:
		pCount = 0
	else:
		pCount += 1
	if pCount == c:
		count += 1
		pCount -= 1
print(count)


(n, t, c) = map(int, input().split())
a = list(map(int, input().split()))
j = 0
x = 0
for i in range(n):
	if a[i] <= t:
		j += 1
	elif a[i] > t:
		j = 0
	if j == c:
		x += 1
		j -= 1
print(x)


a = list(map(int, input().split()))
b = list(map(int, input().split()))
start = -1
answer = 0
for x in range(a[0]):
	if b[x] > a[1]:
		start = x
	if x - start >= a[2]:
		answer += 1
print(answer)


(n, t, c) = map(int, input().split())
a = list(map(int, input().split()))
stack = list()
stack.append(-1)
for i in range(n):
	if a[i] > t:
		stack.append(i)
stack.append(n)
ans = 0
for i in range(len(stack) - 1):
	ll = stack[i + 1] - stack[i] - 1
	ans += max(0, ll - c + 1)
print(ans)


(all_prisioners, crime_limit, transfer_prisioners) = map(int, input().split())
crime_level = list(map(int, input().split()))
total_ways = 0
size = 0
for i in range(all_prisioners):
	if crime_level[i] <= crime_limit:
		size += 1
	else:
		if size >= transfer_prisioners:
			total_ways += size - transfer_prisioners + 1
		size = 0
	i += 1
if size >= transfer_prisioners:
	total_ways += size - transfer_prisioners + 1
print(total_ways)


(n, t, c) = map(int, input().split(' '))
l = list(map(int, input().split(' ')))
a = [-1]
for i in range(0, n):
	if l[i] > t:
		a.append(i)
a.append(n)
k = len(a)
total = 0
for i in range(1, k):
	diff = a[i] - a[i - 1] - 1
	if diff >= c:
		total = total + (diff - c) + 1
print(total)


from math import factorial
(n, t, c) = list(map(int, input().split()))
a = list(map(int, input().split()))
t1 = 0
r = 0
for i in range(n):
	if a[i] <= t:
		t1 += 1
		if t1 >= c:
			r += 1
	else:
		t1 = 0
print(r)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, 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 list(map(int, sys.stdin.readline().split()))

def LLI():
	return [tuple(map(int, l.split())) for l in sys.stdin]

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():
	(n, t, c) = LI()
	a = LI()
	k = 0
	for i in range(c):
		if a[i] > t:
			k += 1
	r = 0
	if k == 0:
		r += 1
	for i in range(c, n):
		if a[i] > t:
			k += 1
		if a[i - c] > t:
			k -= 1
		if k == 0:
			r += 1
	return r
print(main())