inf = float('inf')

N, K, Q = map(int,input().split())
A = list(map(int,input().split()))

nA = sorted(A)
d = []
for i in range(N):
    l = N+1
    r = N+1
    for j in range(i)[::-1]:
        if A[j] < A[i]:
            l = i - j
            break
    for j in range(i, N):
        if A[j] < A[i]:
            r = j - i
            break
    d.append(min(l, r))

ans = inf

for i in range(N-(Q-1)):
    Y = nA[i]
    X = nA[i+Q-1]
    if d[i] > K:
        ans = min(ans, X - Y)

print(ans)