#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>


using namespace std;

typedef long long ll;
typedef long double ld;


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


int tree[sze << 1];
int n, k, q, mx = 0;
vector<int> values, values2;


int get_min(int i, int j)
{
	if (i == -1)
		return j;
	else if (j == -1)
		return i;

	if (values2[i] <= values2[j])
		return i;
	else
		return j;
}


void create_tree()
{
	fill(tree, tree + (sze << 1), -1);

	for (int i = 0; i < n; ++i)
		tree[i + sze] = i;

	for (int i = sze - 1; i; --i)
		tree[i] = get_min(tree[i << 1], tree[i << 1 | 1]);
}


int get(int l, int r, int lb, int rb, int ind)
{
	if (l == lb && r == rb)
		return tree[ind];

	int m = (lb + rb) >> 1;
	int first = -1, second = -1;

	if (l <= m)
		first = get(l, min(m, r), lb, m, ind << 1);

	if (r > m)
		second = get(max(l, m + 1), r, m + 1, rb, ind << 1 | 1);

	return get_min(first, second);
}


void update(int ind, int vl)
{
	values2[ind] = vl;

	ind = (ind + sze) >> 1;

	while (ind)
	{
		tree[ind] = get_min(tree[ind << 1], tree[ind << 1 | 1]);
		ind >>= 1;
	}
}


signed main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	cin >> n >> k >> q;

	vector<int> challengers(n);
	values.resize(n);

	for (int i = 0; i < n; ++i)
	{
		cin >> values[i];
		challengers[i] = values[i];
		mx = max(mx, values[i]);
	}

	sort(challengers.begin(), challengers.end());
	challengers.erase(unique(challengers.begin(), challengers.end()), challengers.end());
	int ans = mx;
	int label = 0;

	for (int v : challengers)
	{
		int l = v - 1, r = mx + 1;

		while (r - l > 1)
		{
			values2 = values;
			create_tree();
			vector<int> used(n);

			int m = (l + r) >> 1;
			int d = -1, u = -1, num = 0;

			int lb = 0, rb = 0, cnt = 0;
			while (lb < n)
			{
				while (rb < n && cnt != k)
				{
					if (!used[rb])
					{
						cnt++;
						used[rb] = 1;
					}
					else
						rb++;
				}

				if (rb == n)
					break;

				int ind = get(lb + 1, rb + 1, 1, sze, 1);

				if (values2[ind] >= v && values2[ind] <= m)
				{
					num++;
					cnt--;

					if (d == -1)
						d = u = values2[ind];
					else
					{
						d = min(d, values2[ind]);
						u = max(u, values2[ind]);
					}

					values2[ind] = INF;
					update(ind, INF);
				}
				else
				{
					cnt--;
					lb++;

					while (lb < n && !used[lb])
						lb++;

					rb = max(lb, rb);
				}
			}

			if (num >= q)
			{
				label = 1;
				r = m;
				ans = min(ans, u - d);
			}
			else
				l = m;
		}
	}

	assert(label);
	cout << ans;

	return 0;
}