#pragma GCC optimize ("O3")
#include <bits/stdc++.h>

#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

#define all(v) (v).begin(), (v).end()
#define fi first
#define se second
#define eb emplace_back
#define pb push_back
#define mp make_pair

template <typename T>
bool uax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template <typename T>
bool uin(T& a, T b) { if (b < a) { a = b; return true; } return false; }

using namespace std;

typedef pair<int, int> pii;
typedef vector<pii> vpi;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef list<int> li;
typedef vector<li> vli;
typedef vector<vpi> vvpi;
typedef long long i64;

const int inf = 1e9 + 500500;

int get(vi& dsu, int i) {
  return dsu[i] != i ? dsu[i] = get(dsu, dsu[i]) : i;
}

void solve_e_fast() {
  int n,k,q;
  cin >> n >> k >> q;
  vi a(n);
  vector<set<int>> S(n);
  set<int> S0, S1;
  vector<int> dsu(n); forn(i, n) dsu[i] = i;
  auto merge = [&] (int i, int j) {
    if ((i = get(dsu, i)) == (j = get(dsu, j))) return ;
    if (S[i].size() < S[j].size()) swap(i, j);
    dsu[j] = i;
    S[i].merge(S[j]);
  };
  forn(i, n) {
    cin >> a[i];
    S[i].insert(a[i]);
  }
  int ans = inf;
  vi ord(n); forn(i, n) ord[i] = i; sort(all(ord), [&] (int i, int j) { return mp(a[i], i) > mp(a[j], j); });
  vi used(n, 0);
  for (int i: ord) {
    if (i + 1 < n && used[i + 1]) merge(i, i + 1);
    if (i > 0 && used[i - 1]) merge(i, i - 1);
    used[i] = 1;
    i = get(dsu, i);
    while (S[i].size() > k - 1) S0.insert(S[i].extract(S[i].begin()));
    while (S0.size() >= q) S1.insert(S0.extract(prev(S0.end())));
    if (S0.size() == q - 1 && !S1.empty()) {
      uin(ans, *(S1.begin()) - *(S0.begin()));
    }
  }
  cout << ans << endl;
}

void solve_e() {
  int n,k,q;
  cin >> n >> k >> q;
  vi a(n);
  forn(i, n) cin >> a[i];
  int ans = inf;
  vi b(a); sort(all(b)); b.erase(unique(all(b)), b.end());
  vi t, z;
  for (int L: b) {
    t.clear(); z.clear();
    for (int x: a) {
      if (x < L) {
        if (t.size() >= k) {
          nth_element(t.begin(), t.begin() + t.size() - k, t.end());
          z.insert(z.end(), t.begin(), t.begin() + t.size() - k + 1);
        }
        t.clear();
      } else t.pb(x);
    }
    if (t.size() >= k) {
      nth_element(t.begin(), t.begin() + t.size() - k, t.end());
      z.insert(z.end(), t.begin(), t.begin() + t.size() - k + 1);
    }
    if (z.size() >= q) {
      nth_element(z.begin(), z.begin() + q - 1, z.end());
      if (q > 1) {
        nth_element(z.begin(), z.begin() + 1, z.begin() + q - 1);
      }
      uin(ans, z[q - 1] - z[0]);
    } else break;
  }
  cout << ans << endl;
}

int main() {
#ifdef HOME
  freopen("../input.txt", "rt", stdin);
#endif
  solve_e_fast();
  return 0;
}
