#include <bits/stdc++.h>
using namespace std;
bool possible(const vector<long long> &A, long long K, long long Q, long long l,
              long long u) {
  long long p = 0;
  long long sum = 0;
  while (p < A.size()) {
    long long q = p;
    long long cnt = 0;
    while (q < A.size() && l <= A[q]) {
      if (A[q] <= u) {
        ++cnt;
      }
      q++;
    }
    sum += min(cnt, (q - p) - K + 1);
    p = q + 1;
  }
  return sum >= Q;
}
signed main() {
  long long N, K, Q;
  cin >> N >> K >> Q;
  vector<long long> A(N);
  for (long long i = 0; i < N; ++i) {
    cin >> A[i];
  }
  long long res = (long long)(1e9 + 10);
  for (long long i = 0; i < N; ++i) {
    long long l = 0, u = (long long)1e+9 + 10;
    while (u - l > 1) {
      long long c = (u + l) / 2;
      if (possible(A, K, Q, A[i], c)) {
        u = c;
      } else {
        l = c;
      }
    }
    if (u < 1e+9 + 5) res = min(res, u - A[i]);
  }
  cout << res << endl;
  return 0;
}
