#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = static_cast<ll>(1e9) + 7;
const int MAXN = static_cast<int>(1e6) + 17;
int n, k, q;
int a[MAXN];
bool read() {
  if (!(cin >> n >> k >> q)) return false;
  for (ll i = 0; i < (ll)(n); ++i) cin >> a[i];
  return true;
}
bool check(vector<vector<int> >& kek, int x) {
  int res = 0;
  for (auto& v : kek)
    res += min(int(upper_bound(v.begin(), v.end(), x) - v.begin()),
               static_cast<int>((v).size()) - k + 1);
  return res >= q;
}
ll calc(int x) {
  vector<vector<int> > kek;
  kek.push_back(vector<int>());
  for (ll i = 0; i < (ll)(n); ++i)
    if (a[i] < x) {
      if (!kek.back().empty()) kek.push_back(vector<int>());
    } else {
      kek.back().push_back(a[i]);
    }
  if (kek.back().empty()) kek.pop_back();
  for (auto& v : kek) sort(v.begin(), v.end());
  ll l = x, r = INF;
  for (; l < r;) {
    auto m = (l + r) / 2;
    if (check(kek, m))
      r = m;
    else
      l = m + 1;
  }
  if (!check(kek, r)) return INF;
  return r - x;
}
void solve() {
  ll ans = INF;
  for (ll i = 0; i < (ll)(n); ++i) ans = min(ans, calc(a[i]));
  cout << ans << '\n';
}
int main() {
  cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::mt19937 rand('S' + 'E' + 'R' + 'E' + 'Z' + 'H' + 'K' + 'A');
  while (read()) solve();
  return 0;
}
