n, k, q = map(int, input().split())
a = [(int(x), i) for i, x in enumerate(input().split())]
a.sort()
m = a[q - 1][0] - a[0][0]
v = []
for i in range(1, n - q + 1):
    mi = a[q - 1 + i][0] - a[i][0]
    v.append((mi, i))
v.sort()
for mi, i in v:
    if mi >= m: break
    ok = True
    for ai in range(i, i + q):
        for bi in range(i):
            if abs(a[bi][1] - a[ai][1]) < k:
                ok = False
                break
        if not ok: break
    if ok:
        m = mi
        break
print(m)
