#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n, k, q;
  cin >> n >> k >> q;
  vector<ll> a(n);
  for (ll i = 0; i < (ll)n; i++) cin >> a[i];
  vector<ll> b = a;
  sort(b.begin(), b.end());
  b.erase(unique(b.begin(), b.end()), b.end());
  ;
  sort(b.begin(), b.end());
  vector<bool> used(n, true);
  ll ans = 1000000000LL * 1000000000LL;
  for (ll i = 0; i < (ll)b.size(); i++) {
    for (ll j = 0; j < (ll)n; j++)
      if (a[j] < b[i]) used[j] = false;
    ll l = b[i] - 1, r = 1000000000LL + 10;
    while (r - l > 1) {
      ll m = (l + r) / 2;
      ll cnt1 = 0, cnt2 = 0;
      vector<P> v;
      for (ll j = 0; j < (ll)n; j++) {
        if (!used[j]) {
          v.push_back(P(cnt1, cnt2));
          cnt1 = cnt2 = 0;
        } else {
          cnt1++;
          if (a[j] <= m) cnt2++;
        }
      }
      v.push_back(P(cnt1, cnt2));
      ll cnt = 0;
      for (ll j = 0; j < (ll)v.size(); j++) {
        cnt += min(v[j].first - k + 1, v[j].second);
      }
      if (cnt >= q)
        r = m;
      else
        l = m;
    }
    if (r != 1000000000LL + 10) ans = min(ans, r - b[i]);
  }
  cout << ans << endl;
  return 0;
}
