n,k,q = map(int,input().split(" "))
ar = list(map(int,input().split(" ")))
cr = []
for i in range(q):
    br = []
    for j in range(len(ar)-k+1):
        br.append(min(ar[j:j+k]))
    cr.append(min(br))
    del ar[ar.index(min(br))]
print(max(cr)-min(cr))      