#include <bits/stdc++.h>
const long long INF = (~0ull) >> 1;
long long n, k, q, a[5010], b[5010], ans = INF;
std::vector<std::pair<long long, long long>> V;
inline long long calc(long long l, long long r, long long max) {
  long long len = r - l + 1;
  long long mc = len - k + 1;
  long long ret = 0;
  for (long long i = l; i <= r; i++)
    if (a[i] <= max) ret++;
  return std::min(ret, mc);
}
inline bool judge(long long min, long long max) {
  long long L = -1, R = -1;
  V.clear();
  for (long long i = 1; i <= n; i++) {
    if (a[i] < min) {
      if (~L) V.push_back({L, R});
      L = R = -1;
    } else {
      if (!~L) L = i;
      R = i;
    }
  }
  if (~L) V.push_back({L, R});
  long long ret = 0;
  for (auto x : V) {
    assert(x.first <= x.second);
    ret += calc(x.first, x.second, max);
  }
  return ret >= q;
}
signed main() {
  scanf("%lld%lld%lld", &n, &k, &q);
  for (long long i = 1; i <= n; i++) scanf("%lld", &a[i]);
  memcpy(b, a, sizeof(a));
  std::sort(b + 1, b + n + 1);
  for (long long i = 1; i <= n; i++) {
    if (i + q - 1 > n) break;
    long long l = i + q - 1, r = n, tmp = INF;
    while (l <= r) {
      long long mid = (l + r) >> 1;
      if (judge(b[i], b[mid])) {
        tmp = b[mid] - b[i];
        r = mid - 1;
      } else {
        l = mid + 1;
      }
    }
    ans = std::min(ans, tmp);
  }
  printf("%lld\n", ans);
  return 0;
}
