#include "omp.h"
#include <iostream>
#include <iomanip>
#include <string>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <vector>
#include <cassert>
#include <fstream>
#include <algorithm>
#include <list>
#include <random>
#include <ctime>
#include <random>
#include <bitset>
#include <unordered_set>
#include <cassert>
#include <list>
#include <functional>


using namespace std;

typedef long long ll;
typedef long double ld;


const int sze = 1 << 11, INF = 1e9 + 10;


int n, k, q;
int kick[sze];




bool check(int up, int down, const vector<int> &values)
{
	priority_queue<int, vector<int>> challengers;
	vector<int> positions[sze];
	fill(kick, kick + sze, 0);

	int ind = 0;
	for (int v : values)
		positions[v].push_back(ind++);

	for (int i = 0; i < sze; ++i)
		sort(positions[i].rbegin(), positions[i].rend());


	//Если на отрезке несколько одинаковых, какой ты удаляешь???
	int l = 0, r = 0, cnt = 0, num = 0;

	while (l < n)
	{
		while (r < n && num < k)
		{
			challengers.push(-values[r]);
			num++;
			r++;

			while (challengers.size() && kick[-challengers.top()])
			{
				kick[-challengers.top()]--;
				challengers.pop();
			}
		}

		if (num != k)
			break;

		int vl = -challengers.top();
		if (vl <= up && vl >= down)
		{
			cnt++;
			num--;
			challengers.pop();
			positions[vl].pop_back();
		}
		else
		{
			if (positions[values[l]].size() && positions[values[l]][positions[values[l]].size() - 1] == l)
			{
				positions[values[l]].pop_back();
				kick[values[l]]++;
				num--;
			}

			l++;
		}
	}

	return cnt >= q;
}


signed main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
	cin >> n >> k >> q;

	vector<int> values(n), challengers;
	
	for (int i = 0; i < n; ++i)
		cin >> values[i];

	challengers = values;
	sort(challengers.begin(), challengers.end());
	

	int M = unique(challengers.begin(), challengers.end()) - challengers.begin();
	challengers.resize(M);

	map<int, int> trans;
	for (int i = 0; i < M; ++i)
		trans[challengers[i]] = i;

	for (int i = 0; i < n; ++i)
		values[i] = trans[values[i]];

	int ans = INF;
	int m = challengers.size();
	for (int i = 0; i < m; ++i)
	{
		int l = i - 1, r = m;

		while (r - l > 1)
		{
			int mid = (l + r) >> 1;
			int up = mid, down = i;

			if (check(up, down, values))
				r = mid;
			else
				l = mid;
		}

		if (r != m)
			ans = min(ans, challengers[r] - challengers[i]);
	}

	cout << ans;
	return 0;
}
