#include<iostream>
#include<algorithm>
#include<unordered_map>
#include<vector>
using namespace std;

int main(void){
    int n, k, q;
    cin >> n >> k >> q;
    vector<int> arr = vector<int>(n);
    vector<int> origin_arr = vector<int>(n);
    unordered_map<int, int> memo;
    for(int i = 0; i < n; i++) cin >> arr[i];

    origin_arr = arr;
    sort(arr.begin(), arr.end());

    for(int i = 0; i < n; i++){
        if(memo[origin_arr[i]] > 0) continue;
        int st = i;
        int count = 0;
        int real_count = 0;
        int rev_count = 0;
        bool stop_to_count = false;
        for(; st >= 0; st--){
            if(origin_arr[st] < origin_arr[i] && memo[origin_arr[st]] == 0) {
                stop_to_count = true;
            }
            if(!stop_to_count && origin_arr[st] >= origin_arr[i]) real_count++;
            if(origin_arr[st] >= origin_arr[i]) count++;
            if(origin_arr[st] < origin_arr[i]) rev_count++;
        }
        if(st < 0) st++;

        int en = i;
        stop_to_count = false;
        for(; en < n; en++){
            if(origin_arr[en] < origin_arr[i] && memo[origin_arr[en]] == 0) {
                stop_to_count = true;
            }
            if(!stop_to_count && origin_arr[en] >= origin_arr[i]) real_count++;
            if(origin_arr[en] >= origin_arr[i]) count++;
            if(origin_arr[en] < origin_arr[i]) rev_count++;
        }

        if(real_count > k) {
            memo[origin_arr[i]] = 1;
        } else if(count > k && rev_count < q){
            memo[origin_arr[i]] = q;
        }
            
    }
    /*
    for(int i = 0; i < n; i++){
        cout << arr[i] << ':' << memo[arr[i]] << endl;
    }
    cout << endl;
    */

    long long result = 2100000000;
    for(int i = 0; i <= n - q; i++){
        if(memo[arr[i]] == 1){
            if(memo[arr[i + q - 1]] != 0){
                //cout<< arr[i + q - 1] - arr[i] << endl;
                if(result > arr[i + q - 1] - arr[i]) result = arr[i + q - 1] - arr[i];
            }
        } else break;
    }

    cout << result << endl;
}
