#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, m;
int tree[sze];


void update(int ind, int v)
{
	for (int i = ind; i <= m; i += i & -i)
		tree[i] += v;
}


int get(int ind)
{
	int cnt = 0;
	for (int i = ind; i; i -= i & -i)
		cnt += tree[i];
	
	return cnt;
}


int get(int l, int r)
{
	if (!l)
		return get(r);

	return get(r) - get(l - 1);
}


int get_ind()
{
	int l = 0, r = m;
	while (r - l > 1)
	{
		int mid = (l + r) >> 1;

		if (get(1, mid))
			r = mid;
		else
			l = mid;
	}

	return r;
}


bool check(int up, int down, const vector<int> &values)
{
	fill(tree, tree + m + 1, 0);
	vector<int> positions[sze];

	for (int i = n - 1; i >= 0; --i)
		positions[values[i]].push_back(i);

	int l = 0, r = 0, cnt = 0;

	while (l < n)
	{
		while (r < n && get(1, m) < k)
		{
			update(values[r], 1);
			r++;
		}

		if (get(1, m) != k)
			break;

		int vl = get_ind();
		if (vl <= up && vl >= down)
		{
			cnt++;
			update(vl, -1);
			positions[vl].pop_back();
		}
		else
		{
			if (positions[values[l]].size() && positions[values[l]][positions[values[l]].size() - 1] == l)
			{
				positions[values[l]].pop_back();
				update(values[l], -1);
			}

			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 + 1;

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

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

		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 + 1)
			ans = min(ans, challengers[r - 1] - challengers[i - 1]);
	}

	cout << ans;
	return 0;
}