#include <bits/stdc++.h>
using namespace std;

using i64=int64_t;

#define rep(i,x,y) for(i64 i=i64(x),i##_max_for_repmacro=i64(y); i<i##_max_for_repmacro; ++i)
#define debug(x) #x << "=" << (x)
 
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif
 
const int inf=1.01e9;
const i64 inf64=4.01e18;
const double eps=1e-9;
 
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
        os << v << ",";
    }
    os << "]";
    return os;
}

template<class T,T op(T,T)> class segtree{
public:
    int n,size_;
    vector<T> dat;
    T id_;
    segtree()=default;
    segtree(int size,T id,T initial_value){ init(size,id,initial_value); }
    void init(int size,T id,T initial_value){
        size_=size;
        id_=id;
        n=1;
        while(n<size) n*=2;
        dat.assign(2*n-1,id);
        for(int i=0; i<size; ++i) update(i,initial_value);
    }
    int size()const{ return size_; }
    void update(int k, T a) {
        k+=n-1; // leaf
        dat[k]=a;
        while(k>0) {
            k=(k-1)/2;
            dat[k]=op(dat[k*2+1],dat[k*2+2]);
        }
    }
    T at(int index){ return dat[index+n-1]; }
    void add(int k,T a){ update(k,at(k)+a); }
    T query(int a,int b) { return query(a,b,0,0,n); }
    T query(int a,int b,int k,int l,int r) {
        if(r<=a or b<=l) return id_;
        if(a<=l and r<=b) return dat[k];
        int m=(l+r)/2;
        return op(query(a,b,k*2+1,l,m),query(a,b,k*2+2,m,r));
    }
};

i64 mymax(i64 a,i64 b){
    return max(a,b);
}

void solve(){
    i64 N,K,Q;
    cin >> N >> K >> Q;

    vector<i64> A(N);
    vector<pair<i64,int>> ps;
    rep(i,0,N){
        cin >> A[i];
        ps.push_back(make_pair(A[i],i));
    }

    sort(begin(ps),end(ps));

    /*
    vector<i64> mi(N-K);
    rep(i,0,N-K){
        i64 tmp=inf64;
        rep(j,i,i+K) tmp=min(tmp,A[i]);
        mi[i]=tmp;
    }

    segtree<i64,mymax> seg(N-K,0,0);
    rep(i,0,N-K) seg.update(i,mi[i]);
    */

    i64 ans=inf64;
    rep(i,0,N){
        i64 lb=ps[i].first;

        vector<int> ls,rs;
        {
            int l=0;
            while(A[l]<lb) ++l;
            rep(j,l,N){
                if(A[j]<lb and l!=-1){
                    ls.push_back(l);
                    rs.push_back(j);
                    l=-1;
                    continue;
                }
                if(A[j]<lb) continue;
                if(l==-1) l=j;
            }
            if(l!=-1){
                ls.push_back(l);
                rs.push_back(N);
            }
        }

        priority_queue<i64> que;
        rep(j,0,ls.size()){
            int l=ls[j],r=rs[j];
            if(r-l<K) continue;
            int cap=r-l-K+1;

            priority_queue<i64> local;
            rep(j,l,r){
                local.push(A[j]);
                if(local.size()>cap) local.pop();
            }

            while(local.size()){
                i64 tmp=local.top();
                local.pop();
                que.push(tmp);
                if(que.size()>Q) que.pop();
            }
        }

        if(que.size()<Q) continue;

        print(lb);
        //cerr << ls << endl;
        //cerr << rs << endl;
        i64 mi=inf64,ma=0;
        while(que.size()){
            i64 tmp=que.top();
            que.pop();
            mi=min(mi,tmp);
            ma=max(ma,tmp);
        }
        print(mi);
        print(ma);
        print(ma-mi);
        ans=min(ans,ma-mi);
        /*
        i64 lb=ps[i].first,ub;
        int cnt=0,j=i;
        while(cnt<Q and j<N){
            int pos=ps[j].second;
            int l=pos-K+1,r=pos+K-1;
            if(seg.query(l,r+1)<lb){
                if(j==i) break;
                ++j;
                continue;
            }
            ub=ps[j].first;
            ++cnt;
            ++j;
        }
        if(cnt<Q) continue;
        print(lb);
        print(ub);
        ans=min(ans,ub-lb);
        */
    }

    cout << ans << endl;
}

int main(){

    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}


Measured memory_bytes: 384