Every evening Vitalya sets n alarm clocks to wake up tomorrow. Every alarm clock rings during exactly one minute and is characterized by one integer a_{i} — number of minute after midnight in which it rings. Every alarm clock begins ringing at the beginning of the minute and rings during whole minute. 

Vitalya will definitely wake up if during some m consecutive minutes at least k alarm clocks will begin ringing. Pay attention that Vitalya considers only alarm clocks which begin ringing during given period of time. He doesn't consider alarm clocks which started ringing before given period of time and continues ringing during given period of time.

Vitalya is so tired that he wants to sleep all day long and not to wake up. Find out minimal number of alarm clocks Vitalya should turn off to sleep all next day. Now all alarm clocks are turned on. 


-----Input-----

First line contains three integers n, m and k (1 ≤ k ≤ n ≤ 2·10^5, 1 ≤ m ≤ 10^6) — number of alarm clocks, and conditions of Vitalya's waking up. 

Second line contains sequence of distinct integers a_1, a_2, ..., a_{n} (1 ≤ a_{i} ≤ 10^6) in which a_{i} equals minute on which i-th alarm clock will ring. Numbers are given in arbitrary order. Vitalya lives in a Berland in which day lasts for 10^6 minutes. 


-----Output-----

Output minimal number of alarm clocks that Vitalya should turn off to sleep all next day long.


-----Examples-----
Input
3 3 2
3 5 1

Output
1

Input
5 10 3
12 8 18 25 1

Output
0

Input
7 7 2
7 3 4 1 6 5 2

Output
6

Input
2 2 2
1 3

Output
0



-----Note-----

In first example Vitalya should turn off first alarm clock which rings at minute 3.

In second example Vitalya shouldn't turn off any alarm clock because there are no interval of 10 consequence minutes in which 3 alarm clocks will ring.

In third example Vitalya should turn off any 6 alarm clocks.

Difficulty: interview

Starter code:

Solutions:
n,m,k = list(map(int, input().strip().split()))
a = list(map(int, input().strip().split()))
a.sort()

count = 0

start = 0
konec = 0
ur = 0
while start < len(a):
    if a[start] is not None:
        v = a[start]
        while konec < len(a) and a[konec] - v < m :
            ur += 1
            if ur >= k:
                #print(a,start,konec,ur)
                a[konec] = None
                count += 1
                ur -= 1
            konec += 1
    if a[start] is not None:
        ur -= 1
    start += 1

print(count)
            
            
    
    


from collections import Counter, deque
def lInt(d = None): return map(int, input().split(d))

n, m, k, *_ = lInt()
a = list(lInt())
f = [0]*1000002
d = deque()
acc = 0; ans = 0

for v in a:
  f[v] = 1
for i in range(1, m+1):
  if f[i]:
    acc += f[i]
    d.append(i)
for i in range(m+1, 1000002):
  while acc >= k:
    f[d.pop()] = 0
    ans += 1
    acc -= 1

  if f[i]:
    acc += f[i]
    d.append(i)
  if f[i-m]:
    acc -= 1
    d.popleft()
print(ans)

from collections import Counter, deque
def lInt(d = None): return map(int, input().split(d))

n, m, k, *_ = lInt()
a = list(lInt())
f = [0]*1000002
d = deque()
acc = 0; ans = 0

for v in a:
  f[v] = 1
for i in range(1, m+1):
  if f[i]:
    acc += f[i]
    d.append(i)
for i in range(m+1, 1000002):
  while acc >= k:
    j = d.pop()

    if f[j]:
      f[j] = 0
      ans += 1
      acc -= 1

  if f[i]:
    acc += f[i]
    d.append(i)
  if f[i-m]:
    acc -= 1
print(ans)

n, m, k = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
a.sort()
ans = 0
z = 0
j = 0
for i in range(len(a)):
    if a[i] == 0:
        z -= 1
        continue
    while j < len(a) and a[j] - a[i] < m:
        if a[j] == 0:
            z += 1
        j += 1
    if j - i - z >= k:
        const =  j - i - k - z + 1
        c = 0
        ct = 0
        while (ct < const):
            if a[j - 1 - c] != 0:
                a[j - 1 - c] = 0
                ans += 1
                ct += 1
                if j - 1 - c != i:
                    z += 1
            c += 1
print(ans)


n, m, k = (int(x) for x in input().split())
ns = set((int(x) for x in input().split()))
from collections import deque
span = deque((0 for i in range(m)))
kk = 0
res = 0
mm = -1
while len(ns) > 0:
    mm += 1
    x = span.popleft()
    if x == 1:
        kk -= 1
    if mm not in ns:
        span.append(0)
    else:
        ns.remove(mm)
        y = 1
        if kk == k - 1:
            res += 1
            y = 0
        span.append(y)
        kk+=y
print(res)

n, m, k = (int(x) for x in input().split())
ns = set((int(x) for x in input().split()))
from collections import deque
span = deque((0 for i in range(m)))
kk = 0
res = 0
mm = -1
while len(ns) > 0:
    mm += 1
    x = span.popleft()
    if x == 1:
        kk -= 1
    if mm not in ns:
        span.append(0)
    else:
        ns.remove(mm)
        y = 1
        if kk == k - 1:
            res += 1
            y = 0
        span.append(y)
        kk+=y
print(res)

from collections import deque

n,m,k = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
a = sorted(a)
a = deque(a)
first = - 10e7
r = deque([])
s = 0
result = 0
while n > 0:
    e = a[0]
    c = e - m + 1
    while r != deque([]):
        if r[0] < c:
            r.popleft()
            s -= 1
        else:
            break
    if s + 1 >= k:
        result += 1
    else:
        r.append(e)
        s += 1
    a.popleft()
    n -= 1
    # print(e, c, s, r, result)

print(result)


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


f = lambda: map(int, input().split())
n, m, k = f()
t = sorted(f())
d = [1] * n
i = s = 0
for j in range(n):
    while t[j] - t[i] >= m:
        k += d[i]
        i += 1
    k -= 1
    if k < 1:
        s += 1
        k = 1
        d[j] = 0
print(s)

n, m, k = list(map(int, input().split()))
times = list(map(int, input().split()))
times.sort()
ans = 0
start = 0
cnt = 0
j = 0
prohibited = []
for i in range(n):
	prohibited += [1]
for i in range(n):
	if times[i] < start + m:
		cnt += 1
	else: 
		while times[i] >= start + m:
			if prohibited[j] == 1:
				start = times[j]
				if j != 0:
					cnt -= 1
			j += 1
		cnt += 1
	if cnt == k:
		cnt -= 1
		ans += 1
		prohibited[i] = 0
if k == 1:
	print(n)
else:
	print(ans)


n, m, k = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
d = []
ans = 0

for i in a:
    if len(d) > 0 and d[0] < i - m + 1:
        del d[0]

    if len(d) < k - 1:
        d.append(i)
    else:
        ans += 1

print(ans)


n, m, k = list(map(int, input().split()))
a = list(map(int, input().split()))

a = list(sorted(a))
s = []
r = 0

for x in a:
    if len(s) and s[0] < x - m + 1:
        del s[0]

    if len(s) < k - 1:
        s.append(x)

    else:
        r += 1


print(r)


n,m,k = list(map(int,input().split()))
clock = list(map(int,input().split()))
clock.sort()
unlock = [1] * n
count = 0
j = 0
if k == 1:
    count = n
else:
    for i in range(n):
        while clock[i] - clock[j] >= m:
            k += unlock[j]
            j += 1
        k -= 1
        if k < 1:
            count += 1
            k = 1
            unlock[i] = 0
print(count)
    
    
    
    


n, m, k = list(map(int, input().split()))
a = list(map(int, input().split()))

a = list(sorted(a))
s = []
r = 0

for x in a:
    if len(s) and s[0] < x - m + 1:
        del s[0]

    if len(s) < k - 1:
        s.append(x)

    else:
        r += 1

print(r)
    


n, m, k = list(map(int, input().split()))
a = list(map(int, input().split()))

a = list(sorted(a))
s = []
r = 0

for x in a:
    if len(s) and s[0] < x - m + 1:
        del s[0]

    if len(s) < k - 1:
        s.append(x)

    else:
        r += 1

print(r)
    


n, m, k = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
vis = []
for i in range(n):
    vis.append(0)
ans = l = r = 0
cnt = 1
while(r < n):
    while(a[r]-a[l]+1 > m):
	    if(vis[l] == 0):
		    cnt -= 1
	    l += 1
    if cnt >= k:
        ans += 1
        vis[r] = 1;
        cnt -= 1
    r += 1
    cnt += 1
print(ans)

k=input().split()
n,m,k=int(k[0]),int(k[1]),int(k[2])
a=[0]*1000001
c=input().split()
for i in range(n):
    a[int(c[i])]=1
b=0
p=0
for i in range(m):
    if a[i]==1:
        p+=1
    if p==k:
        a[i]=0
        p-=1
        b+=1
for i in range(m,1000001):
    if a[i-m]==1:
        p-=1
    if a[i]==1:
        p+=1
    if p==k:
        a[i]=0
        p-=1
        b+=1
print(b)

# TAIWAN NUMBER ONE!!!!!!!!!!!!!!!!!!!
# TAIWAN NUMBER ONE!!!!!!!!!!!!!!!!!!!
# TAIWAN NUMBER ONE!!!!!!!!!!!!!!!!!!!
from sys import stdin, stdout
import math
import heapq
from itertools import accumulate

#N = int(input())

#s = input() 
N,M,K = [int(x) for x in stdin.readline().split()]

arr = [int(x) for x in stdin.readline().split()]

freq = [0]*(1000000)

for num in arr:
    freq[num-1] += 1

s = 0
res = 0
for i in range(1000000):
    if i>=M:
        s -= freq[i-M]

    s += freq[i]
    #print(s)
    if s>=K:
        res += (s - K + 1)
        freq[i] -= (s - K + 1)
        s -= (s - K + 1)
        
print(res)
    


n,m,k=list(map(int,input().split()))
cnt=[0]*(10**6+5)
l=[int(i) for i in input().split()]
for i in l:
    cnt[i]+=1
sm=0 
for i in range(10**6+5):
    sm+=cnt[i]
    if(i>=m): 
        sm-=cnt[i-m]
    if(sm>=k):
        sm-=1 
        cnt[i]=0 
print(n-sum(cnt))



n, m, k=[int(x) for x in input().split()]
alarms=[int(x) for x in input().split()]
alarms.sort()
al2=[]
cont=0
for i in range(len(alarms)):
    al2.append(alarms[i])
    if len(al2)>=k and al2[-1]-al2[len(al2)-k]<m:
        al2.pop()
        cont+=1
print(cont)


n,m,k = list(map(int,input().split()))
arr = list(map(int,input().split()))
arr.sort()
size = k-1
ans = []
f = 0
i = 0
while i<n:
    if ans==[]:
        if len(ans)<size:
            ans.append(arr[i])
            i+=1
        else:
            f+=1
            i+=1
    else:
        u = ans[0]
        limit = u+m-1
        while(i<n):
            if arr[i]<=limit:
                if len(ans)<k-1:
                    ans.append(arr[i])
                else:
                    f+=1
                i+=1
            else:
                break
        ans.pop(0)
print(f)

n,m,k = list(map(int,input().split()))
lis = sorted(map(int,input().split()))+[1000000000000000]
j=zer=ans=0
for i in range(n):
    if lis[i]==0:
        zer-=1
        continue
    j=max(j,i)
    while j<=n and lis[j]-lis[i]<m:
        j+=1
    if j-i-zer>=k:
        a=j-1
        ext=j-i-zer-k+1
        t=0
        while a>=0 and ext>0:
            if lis[a]!=0:
                lis[a]=0
                t+=1
                zer+=1
                ext-=1
            a-=1
        ans+=t
    if lis[i]==0:
        zer-=1       
print(ans)