#include "bits/stdc++.h"
using namespace std;
const int maxn = 300300;
char s[maxn];
int p[maxn], a[maxn], bad[maxn];
int n, k, q;
int mt1(){
    memcpy(a, p, sizeof(a));
    sort(a, a + n);
    int best = 1e9;
    for(int e = 0; e < n; e++){
        int lo = e + q - 1, hi = n - 1;
        if(lo >= n) break;
        while(hi < n - 1 && a[hi + 1] - a[lo] < best) hi++;
        int x = 1;
        while(lo <= hi){
            int mid = (lo + hi)>>1;
            int L = a[e], R = a[mid];
            set<pair<int,int> > sweep;
            int bg = 0, ed = 0;
            for(int f = 0; f < n; f++) bad[f] = 0;
            for(int f = 0; f < k; f++, ed++)
                sweep.insert(make_pair(p[ed], ed) );
            int ops = 0;
            for(int f = 0; f < n && ops < q; f++){
                auto it = *sweep.begin();
                if(L <= it.first && it.first <= R){
                    bad[it.second] = 1;
                    sweep.erase(sweep.begin());
                    ops++;
                } else {
                    while(bg < n && bad[bg]) bg++;
                    sweep.erase(make_pair(p[bg], bg));
                    bad[bg] = 1;
                }
                if(ed == n) break;
                sweep.insert(make_pair(p[ed], ed)); ed++;
            }
            if(ops >= q){
                best = min(best, R - L);
                hi = mid - 1;
                x = 0;
            } else {
                lo = mid + 1;
            }
        }
        if(x) break;
    }
    return best;
}
int mt2(){
    memcpy(a, p, sizeof(a));
    sort(a, a + n);
    int best = 1e9;
    for(int e = 0; e < n; e++){
        int lo = e, hi = n - 1;
        while(lo <= hi){
            int mid = (lo + hi)>>1;
            int L = a[e], R = a[mid];
            set<pair<int,int> > sweep;
            int bg = 0, ed = 0;
            for(int f = 0; f < n; f++) bad[f] = 0;
            for(int f = 0; f < k; f++, ed++)
                sweep.insert(make_pair(p[ed], ed) );
            int ops = 0;
            for(int f = 0; f < n && ops < q; f++){
                auto it = *sweep.begin();
                if(L <= it.first && it.first <= R){
                    bad[it.second] = 1;
                    sweep.erase(sweep.begin());
                    ops++;
                } else {
                    while(bg < n && bad[bg]) bg++;
                    sweep.erase(make_pair(p[bg], bg));
                    bad[bg] = 1;
                }
                if(ed == n) break;
                sweep.insert(make_pair(p[ed], ed)); ed++;
            }
            if(ops >= q){
                best = min(best, R - L);
                hi = mid - 1;
            } else {
                lo = mid + 1;
            }
        }
    }
    return best;
}
int main(){
    srand(time(NULL));
    // for(int cd = 0; cd < 100; cd++){
    //     n = 100; k = 30; q = n - k + 1;
        cin >> n >> k >> q;
        for(int e = 0; e < n; e++){
            p[e] = rand() % ((int)1e9);
            cin >> p[e];
        }
        int v1 = mt1();
    //     int v2 = mt2();
    //     if(v1 != v2){
    //         cout << v1 << " " << v2 << endl;
    //     }
    //     assert(v1 == v2);
    //     cerr << "ok " << cd  + 1 << endl;
    // }
    cout << v1 << endl;
    cerr << 1.0 * clock()/CLOCKS_PER_SEC << endl;
    return 0;
}


Measured memory_bytes: 1536