n, k, q = read_line.split.map(&.to_i)
a = read_line.split.map(&.to_i64).map_with_index { |v, i| v * n + i }
sorted = a.sort
ans = sorted[-1] - sorted[0]
a << 0i64
lo = 0
hi = 1
while lo < n && hi < n
  if count(a, k, sorted[lo], sorted[hi]) < q
    hi += 1
  else
    ans = {ans, sorted[hi - 1] - sorted[lo]}.min
    lo += 1
  end
end
puts ans // n

def count(a, k, small, large)
  ret = 0
  pi = 0
  non_large_count = 0
  1.upto(a.size) do |i|
    if a[i - 1] < small
      len = i - pi - 1
      ret += {0, {len - k + 1, non_large_count}.min}.max
      pi = i
      non_large_count = 0
    elsif a[i - 1] < large
      non_large_count += 1
    end
  end
  return ret
end
