#include <bits/stdc++.h>
using namespace std;
char _buf[12 * 1000000 + 3];
int loadint() {
  if (fgets(_buf, 12 + 3, stdin) == NULL) return 0;
  return atoi(_buf);
}
int loadvec(vector<int> &v, int N = -1) {
  if (N == -1) {
    N = loadint();
    if (N == 0) return 0;
  }
  int bufsize = 12 * N + 3;
  if (fgets(_buf, bufsize, stdin) == NULL) return 0;
  v.resize(N);
  int i = 0;
  bool last = false;
  for (char *p = &_buf[0];;) {
    char *q = p;
    while (*q > ' ') ++q;
    if (*q == 0x0D || *q == 0x0A) last = true;
    *q = 0;
    v[i++] = atoi(p);
    if (last || i == N) break;
    p = q + 1;
  }
  return i;
}
int N, K, Q;
vector<int> a;
long long solve() {
  map<int, vector<int> > mu;
  for (int i = 0; i < (N); ++i) mu[a[i]].push_back(i);
  vector<pair<int, int> > ranges;
  ranges.push_back(pair<int, int>(0, N - 1));
  vector<int> tmp((a).begin(), (a).end());
  sort((tmp).begin(), (tmp).end());
  int best = tmp[Q - 1] - tmp[0];
  for (auto p : mu) {
    int minp = p.first;
    for (int i : p.second) {
      tmp.clear();
      for (int j = ranges.size() - 1; j >= 0; --j) {
        if (((ranges[j].first) <= (i) && (i) <= (ranges[j].second))) {
          for (int c = ranges[j].first; c <= ranges[j].second; ++c) {
            if (c == i) continue;
            tmp.push_back(a[c]);
          }
          if (i + 1 + (K - 1) <= ranges[j].second) {
            ranges.insert(ranges.begin() + j + 1,
                          pair<int, int>(i + 1, ranges[j].second));
          }
          if (ranges[j].first + (K - 1) <= i - 1) {
            ranges[j].second = i - 1;
          } else {
            ranges.erase(ranges.begin() + j);
          }
          break;
        } else {
          for (int c = ranges[j].first; c <= ranges[j].second; ++c) {
            tmp.push_back(a[c]);
          }
        }
      }
      if (ranges.empty()) goto break_loop;
      sort((tmp).begin(), (tmp).end());
      if (tmp.size() < Q - 2) break;
      int score = tmp[Q - 2] - minp;
      best = min(best, score);
    }
  }
break_loop:
  return best;
}
int main() {
  a.reserve(2000);
  loadvec(a, 3);
  N = a[0];
  K = a[1];
  Q = a[2];
  loadvec(a, N);
  cout << solve() << endl;
  return 0;
}
