import Data.List (sort)
import Data.Maybe (maybeToList)

splitBy :: (a -> Bool) -> [a] -> [[a]]
splitBy _ [] = []
splitBy p xs = us : splitBy p (dropWhile p vs)
  where (us,vs) = break p xs

elemAt :: Int -> [a] -> Maybe a
elemAt _ []     = Nothing
elemAt 0 (x:_)  = Just x
elemAt k (_:xs) = elemAt (k-1) xs

solve :: Int -> Int -> [Int] -> Int
solve k q xs = minimum $ concatMap (\x -> solve1 k q x xs) xs
  where solve1 k q x = maybeToList . fmap (subtract x) . elemAt (q-1) . sort . concatMap ((\xs -> take (length xs - k + 1) xs) . sort) . filter ((>= k) . length) . splitBy (< x)

main :: IO ()
main = do
  [_n, k, q] <- map read . words <$> getLine :: IO [Int]
  xs <- map read . words <$> getLine :: IO [Int]
  print $ solve k q xs
