#include <bits/stdc++.h>
using namespace std;
using i64 = long long int;
using ii = pair<int, int>;
using ii64 = pair<i64, i64>;
class FenwickTree {
 public:
  FenwickTree(int k) {
    data.resize(k);
    arr.resize(k);
  }
  i64 sum(int n) {
    i64 ans = 0;
    while (n > 0) {
      ans += data[n];
      n -= (n & -n);
    }
    return ans;
  }
  void set(int n, i64 num) {
    i64 diff = num - arr[n];
    if (diff != 0) add(n, diff);
  }
  void add(int n, i64 num) {
    arr[n] += num;
    while (n < data.size()) {
      data[n] += num;
      n += (n & -n);
    }
  }
  int find(int k) {
    int res = -1;
    int lo = 1, hi = data.size() - 1;
    while (lo <= hi) {
      int mid = (lo + hi) / 2;
      if (sum(mid) >= k) {
        res = mid;
        hi = mid - 1;
      } else {
        lo = mid + 1;
      }
    }
    return res;
  }

 private:
  vector<i64> data;
  vector<i64> arr;
};
int main() {
  int n, k, q;
  scanf("%d %d %d", &n, &k, &q);
  vector<int> arr(n + 1);
  for (int i = 1; i <= n; i++) scanf("%d", &arr[i]);
  vector<ii> sorted(n + 1);
  for (int i = 1; i <= n; i++) sorted[i] = ii(arr[i], i);
  sort(sorted.begin(), sorted.end());
  vector<int> group(n + 1);
  vector<ii> lr;
  vector<set<ii>> seg;
  lr.emplace_back(1, n);
  seg.emplace_back();
  FenwickTree tree(n + 1);
  for (int i = 1; i <= n; i++) {
    tree.add(i, 1);
    seg[0].emplace(arr[i], i);
  }
  int ans = sorted[q].first - sorted[1].first;
  for (int i = 1; i < n; i++) {
    int pos = sorted[i].second;
    int g = group[pos];
    int l = lr[g].first;
    int r = lr[g].second;
    seg.emplace_back();
    int ng = lr.size();
    int sl = l, sr = pos - 1, hl = pos + 1, hr = r;
    if (pos - l > r - pos) {
      swap(sl, hl);
      swap(sr, hr);
    }
    for (int j = sl; j <= sr; j++) {
      group[j] = ng;
      seg[g].erase(ii(arr[j], j));
      seg[ng].insert(ii(arr[j], j));
    }
    lr[g].first = hl;
    lr[g].second = hr;
    lr.emplace_back(sl, sr);
    seg[g].erase(ii(arr[pos], pos));
    tree.set(pos, 0);
    while (seg[g].size() > hr - hl - k + 2) {
      auto r = --seg[g].end();
      tree.set(r->second, 0);
      seg[g].erase(r);
    }
    while (seg[ng].size() > sr - sl - k + 2) {
      auto r = --seg[ng].end();
      tree.set(r->second, 0);
      seg[ng].erase(r);
    }
    int idx = tree.find(q);
    if (idx != -1) ans = min(ans, arr[idx] - sorted[i + 1].first);
  }
  printf("%d\n", ans);
  return 0;
}
