# Generated by AtcoderGreedy on 2018-05-26
# ARC098 E
# Your code here

N, K, Q = gets.chomp.split(' ').map(&:to_i)
A = gets.chomp.split(' ').map(&:to_i)

mins = A.sort.take(Q)

puts(mins.last - mins[0])
