#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e9 + 7;
const long long mod = 1e9 + 7;
long long linf = (1LL << 31) - 1LL;
long long n;
vector<long long> RMQ(1 << 21);
void init(long long n_) {
  n = 1;
  while (n < n_) {
    n *= 2;
  }
  for (int i = (0); i < (n * 2 - 1); i++) {
    RMQ[i] = linf;
  }
}
void update(long long k, long long a) {
  k += n - 1;
  RMQ[k] = a;
  while (k > 0) {
    k--;
    k /= 2;
    RMQ[k] = min(RMQ[2 * k + 1], RMQ[2 * k + 2]);
  }
}
long long query(long long a, long long b, long long k, long long l,
                long long r) {
  if (r <= a || l >= b) return linf;
  if (l >= a && r <= b)
    return RMQ[k];
  else {
    return min(query(a, b, k * 2 + 1, l, (l + r) / 2),
               query(a, b, k * 2 + 2, (l + r) / 2, r));
  }
}
int main() {
  long long n_, k, q;
  cin >> n_ >> k >> q;
  vector<long long> a(n_ + 1);
  vector<pair<long long, long long> > b(n_ + 1);
  b[0] = make_pair(0, 0);
  for (int i = (0); i < (n_); i++) {
    cin >> a[i + 1];
    b[i + 1] = make_pair(a[i + 1], i + 1);
  }
  sort(b.begin(), b.end());
  long long ans = inf;
  init(n_ + 2);
  for (int j = (0); j < (n_); j++) {
    update(j + 1, a[j + 1]);
  }
  update(0, 0LL);
  update(n_ + 1, 0LL);
  long long cnt = 0;
  long long g;
  long long s;
  long long i = 0;
  for (int j = (i + 1); j < (n_ + 1); j++) {
    long long border = 0;
    long long l = -1, r = b[j].second;
    while (r - l > 1) {
      long long mid = (r + l) / 2;
      if (query(mid, b[j].second + 1, 0, 0, n) == b[j].first)
        r = mid;
      else
        l = mid;
    }
    border += b[j].second - r;
    l = b[j].second + 1, r = n_ + 2;
    while (r - l > 1) {
      long long mid = (r + l) / 2;
      if (query(b[j].second, mid, 0, 0, n) == b[j].first)
        l = mid;
      else
        r = mid;
    }
    border += l - b[j].second;
    if (border >= k + cnt) {
      cnt++;
      update(b[j].second, inf);
    }
    if (cnt == 1) {
      s = b[j].first;
    }
    if (cnt == q) {
      g = b[j].first;
      break;
    }
  }
  ans = g - s;
  long long L = 0, R = n_ + 1;
  while (R - L > 1) {
    long long i = (L + R) / 2;
    for (int j = (0); j < (n_); j++) {
      update(j + 1, a[j + 1]);
    }
    update(0, 0LL);
    update(n_ + 1, 0LL);
    long long cnt = 0;
    long long g;
    long long s;
    for (int j = (i + 1); j < (n_ + 1); j++) {
      long long border = 0;
      long long l = -1, r = b[j].second;
      while (r - l > 1) {
        long long mid = (r + l) / 2;
        if (query(mid, b[j].second + 1, 0, 0, n) == b[j].first)
          r = mid;
        else
          l = mid;
      }
      border += b[j].second - r;
      l = b[j].second + 1, r = n_ + 2;
      while (r - l > 1) {
        long long mid = (r + l) / 2;
        if (query(b[j].second, mid, 0, 0, n) == b[j].first)
          l = mid;
        else
          r = mid;
      }
      border += l - b[j].second;
      if (border >= k + cnt) {
        cnt++;
        update(b[j].second, inf);
      }
      if (cnt == 1) {
        s = b[j].first;
      }
      if (cnt == q) {
        g = b[j].first;
        break;
      }
    }
    if (cnt == q) {
      ans = min(ans, g - s);
      L = i;
    } else {
      R = i;
    }
  }
  cout << ans << endl;
}
