#include <bits/stdc++.h>
namespace IO {
template <typename T>
void read(T& v) {
  register char ch;
  register T f = 1, x = 0;
  do {
    ch = getchar();
    if (ch == '-') f = -1;
  } while (!isdigit(ch));
  do {
    x = x * 10 + ch - '0';
    ch = getchar();
  } while (isdigit(ch));
  v = x * f;
}
}  // namespace IO
const int N = 2e3 + 2, INF = 0x7fffffff, MOD = 1e9 + 7;
namespace Problem {
int n, k, q, a[N], b[N], c[N], ans = INF;
void work(int x) {
  int l, r;
  l = r = 1, b[0] = 0;
  while (l <= n) {
    c[0] = 0;
    while (l <= n && a[l] < x) l++;
    r = l;
    while (r <= n && a[r] >= x) r++;
    for (int i = l; i < r && i <= n; i++) c[++c[0]] = a[i];
    if (c[0] >= k) {
      std::sort(c + 1, c + c[0] + 1);
      for (int i = 1; i <= c[0] - k + 1; i++) b[++b[0]] = c[i];
    }
    l = r;
  }
  std::sort(b + 1, b + b[0] + 1);
  if (b[0] > q) ans = std::min(ans, b[q] - b[1]);
}
void solve() {
  using namespace IO;
  read(n), read(k), read(q);
  for (int i = 1; i <= n; i++) read(a[i]);
  std::sort(a + 1, a + n + 1);
  for (int i = 1; i <= n; i++) work(a[i]);
  printf("%d", ans);
}
}  // namespace Problem
int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  Problem::solve();
  return 0;
}
