use std::cmp::{max, min};
use std::io::{stdin, Read};

#[allow(unused_macros)]
macro_rules! parse {
    ($it: ident ) => {};
    ($it: ident, ) => {};
    ($it: ident, $var:ident : $t:tt $($r:tt)*) => {
        let $var = parse_val!($it, $t);
        parse!($it $($r)*);
    };
    ($it: ident, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = parse_val!($it, $t);
        parse!($it $($r)*);
    };
}

#[allow(unused_macros)]
macro_rules! parse_val {
    ($it: ident, [$t:tt; $len:expr]) => {
        (0..$len).map(|_| parse_val!($it, $t)).collect::<Vec<_>>();
    };
    ($it: ident, ($($t: ty),*)) => {
        ($(parse_val!($it, $t)),*)
    };
    ($it: ident, $t: ty) => {
        $it.next().unwrap().parse::<$t>().unwrap()
    };
}

fn solve(s: &str) {
    let mut it = s.split_whitespace();
    parse!(it, n: usize, k: usize, q: usize, a: [usize; n]);
    let mut sorteda: Vec<_> = a.clone();
    sorteda.sort();
    let mut cur = sorteda[0];
    let mut ret = std::usize::MAX;
    loop {
        let mut cl = vec![];
        let mut c = vec![];
        for i in 0..n {
            if a[i] < cur {
                if c.len() > 0 {
                    c.sort();
                    cl.push(c);
                    c = vec![];
                }
            } else {
                c.push(a[i]);
            }
        }
        if c.len() > 0 {
            c.sort();
            cl.push(c)
        }

        let mut m = vec![];
        for c in cl.iter_mut() {
            let l = c.len();
            if l < k {
                continue;
            }
            m.append(&mut c[..(l - k + 1)].to_vec());
        }
        m.sort();
        if m.len() < q {
            break;
        }
        ret = min(ret, m[q - 1] - cur);

        cur = sorteda[sorteda.binary_search(&(cur + 1)).unwrap_or_else(|x| x)];
    }
    println!("{}", ret);
}

fn main() {
    let mut s = String::new();
    stdin().read_to_string(&mut s).unwrap();
    solve(&s);
}

#[cfg(test)]
mod tests {
    use super::*;
    #[test]
    fn test_input() {
        let s = "
        ";
        solve(s);
    }
}
