#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
template <class T>
using V = vector<T>;
const ll inf = (1e18);
const ll mod = 1000000007;
ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
ll LCM(ll c, ll d) { return c / GCD(c, d) * d; }
struct __INIT {
  __INIT() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
  }
} __init;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int main() {
  int n, k, q;
  cin >> n >> k >> q;
  V<P> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i].first;
    a[i].second;
  }
  sort((a).begin(), (a).end());
  V<ll> d(n, 0), que(n, 0);
  V<ll> dat(n, inf);
  for (int i = 0; i < n; i++) {
    int cnt = -1;
    int now = a[i].second;
    while (now >= 0 && dat[now] >= a[i].first) {
      now--;
      if (dat[now] != a[i].first) cnt++;
    }
    now = a[i].second;
    int t = now;
    while (now < n && dat[now] >= a[i].first) {
      now++;
      if (dat[now] != a[i].first) cnt++;
    }
    if (cnt >= k) {
      for (int j = 0; j <= i; j++) {
        if (d[j] != inf && que[j] < q) {
          que[j]++;
          d[j] = a[i].first;
        }
      }
    } else {
      ll val = inf;
      while (cnt < k) {
        ll l = -inf, r = -inf;
        if (t >= 0) l = dat[t];
        if (now < n) r = dat[now];
        if (l < r) {
          chmin(val, r);
          cnt++;
          now++;
          while (now < n && a[i].first <= dat[now]) {
            now++;
            if (dat[now] != a[i].first) cnt++;
          }
        } else {
          chmin(val, l);
          cnt++;
          t--;
          while (t >= 0 && a[i].first <= dat[t]) {
            t--;
            if (dat[t] != a[i].first) cnt++;
          }
        }
      }
      for (int j = 0; j < i; j++) {
        if (a[j].first > val) break;
        if (d[j] != inf && que[j] < q) {
          que[j]++;
          d[j] = a[i].first;
        }
      }
      d[i] = inf;
    }
    dat[a[i].second] = a[i].first;
  }
  ll ans = inf;
  for (int i = 0; i < n; i++) {
    if (que[i] >= q) {
      chmin(ans, d[i] - a[i].first);
    }
  }
  cout << ans << "\n";
}
