#[allow(dead_code)]
fn getline() -> String {
    let mut res = String::new();
    std::io::stdin().read_line(&mut res).ok();
    res
}

#[allow(unused_macros)]
macro_rules! readl {
    ($t: ty) => {
        {
            let s = getline();
            s.trim().parse::<$t>().unwrap()
        }
    };
    ($( $t: ty),+ ) => {
        {
            let s = getline();
            let mut iter = s.trim().split(' ');
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
}

#[allow(unused_macros)]
macro_rules! readlvec {
    ($t: ty) => {
        {
            let s = getline();
            let iter = s.trim().split(' ');
            iter.map(|x| x.parse().unwrap()).collect::<Vec<$t>>()
        }
    }
}

#[allow(unused_macros)]
macro_rules! debug { ($x: expr) => { println!("{}: {:?}", stringify!($x), $x) } }
// macro_rules! debug { ($x: expr) => () }

#[allow(dead_code)]
fn show<T>(iter: T) -> String
where
    T: Iterator,
    T::Item: std::fmt::Display
{
    let mut res = iter.fold(String::new(), |sum, e| sum + &format!("{} ", e));
    res.pop();
    res
}

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::collections::btree_map::Entry::{Occupied, Vacant};

fn main() {
    use std::io::Write;
    let out = std::io::stdout();
    let mut out = std::io::BufWriter::new(out.lock());
    macro_rules! printf { ($($arg:tt)*) => (write!(out, $($arg)*).unwrap()); }
    macro_rules! printfln { () => (writeln!(out).unwrap()); ($($arg:tt)*) => (writeln!(out, $($arg)*).unwrap()); }
    
    let (n, k, q) = readl!(usize, usize, usize);
    let a = readlvec!(i64);

    let mut b = a.clone();
    b.sort();
    let mut ans = b[q-1]-b[0];
    b.dedup();
    let mut fv = vec![false; n];
    for rm in b {
        for (i, _) in a.iter().enumerate().filter(|&(_, &e)| e == rm) {
            fv[i] = true;
        }
        let mut ta = Vec::new();
        let mut l = 0;
        let mut r = 0;
        while l < n {
            let mut v = Vec::new();
            while r < n && !fv[r] {
                v.push(a[r]);
                r += 1;
            }
            if k <= v.len() {
                v.sort();
                for &e in v.iter().take(v.len()-k+1) {
                    ta.push(e);
                }
            }
            if l == r {
                l += 1;
                r += 1;
            } else {
                l = r;
            }
        }
        // debug!(ta);
        if ta.len() > q-1 {
            ans = min(ans, ta[q-1]-ta[0]);
        }
    }
    printfln!("{}", ans);
}
