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


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

	int n, k, q, mx = 0;
	cin >> n >> k >> q;

	vector<int> challengers(n), values(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)
		{
			multiset<int> 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;
						tree.insert(values[rb]);
					}
					else
						rb++;
				}

				if (rb == n)
					break;

				int vl = *tree.begin();
				if (vl >= v && vl <= m)
				{
					num++;
					cnt--;

					if (d == -1)
						d = u = vl;
					else
					{
						d = min(d, vl);
						u = max(u, vl);
					}

					tree.erase(tree.begin());
				}
				else
				{
					cnt--;
					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;
}