#include <iostream>
#include <algorithm>
using namespace std;
int n, k, q;
int a[1000006], b[1000006];
bool check(int l, int r){
	int ans = 0, cnt = 0, cnt2 = 0;
	for (int i = 1; i <= n; ++ i)
		if (a[i] < l){
			if (cnt >= k)
				ans += min(cnt2, cnt - k + 1);
			cnt = cnt2 = 0;
		}
		else{
			++ cnt;
			if (a[i] <= r)
				++ cnt2;
		}
	if (cnt >= k)
		ans += min(cnt2, cnt - k + 1);
	return ans >= q;
}
int bs(int lower, int l, int r){
	int ans = 2000000000;
	while (l <= r){
		int m = l + r >> 1;
		if (check(lower, b[m])){
			ans = b[m];
			r = m - 1;
		}
		else
			l = m + 1;
	}
	return ans;
}
int main(){
	cin >> n >> k >> q;
	for (int i = 1; i <= n; ++ i){
		cin >> a[i];
		b[i] = a[i];
	}
	sort(b + 1, b + 1 + n);
	int ans = 2000000000;
	for (int i = 1; i <= n; ++ i)
		ans = min(ans, bs(b[i], i, n) - b[i]);
	cout << ans << endl;
}
