#include <bits/stdc++.h>
using namespace std;
template <class T, class U>
inline void chmin(T& a, U const& b) {
  a = min<T>(a, b);
}
class fully_indexable_dictionary {
  static constexpr size_t block_size = 64;
  vector<uint64_t> block;
  vector<int32_t> rank_block;

 public:
  size_t size;
  fully_indexable_dictionary() = default;
  template <typename T>
  fully_indexable_dictionary(vector<T> const& bits) {
    size = bits.size();
    size_t block_count = size / block_size + 1;
    block.resize(block_count);
    for (int i = 0; (i) < (int)(size); ++(i))
      if (bits[i]) {
        block[i / block_size] |= (1ull << (i % block_size));
      }
    rank_block.resize(block_count);
    rank_block[0] = 0;
    for (int i = 0; (i) < (int)(block_count - 1); ++(i)) {
      rank_block[i + 1] = rank_block[i] + __builtin_popcountll(block[i]);
    }
  }
  int rank(bool value, int r) const {
    assert(0 <= r and r <= size);
    uint64_t mask = (1ull << (r % block_size)) - 1;
    int rank_1 = rank_block[r / block_size] +
                 __builtin_popcountll(block[r / block_size] & mask);
    return value ? rank_1 : r - rank_1;
  }
  int rank(bool value, int l, int r) const {
    assert(0 <= l and l <= r and r <= size);
    return rank(value, r) - rank(value, l);
  }
};
template <int BITS>
struct wavelet_matrix {
  static_assert(BITS < CHAR_BIT * sizeof(uint64_t), "");
  array<fully_indexable_dictionary, BITS> fid;
  array<int, BITS> zero_count;
  wavelet_matrix() = default;
  template <typename T>
  wavelet_matrix(vector<T> data) {
    int size = data.size();
    for (int i = 0; (i) < (int)(size); ++(i)) {
      assert(0 <= data[i] and data[i] < (1ull << BITS));
    }
    vector<char> bits(size);
    vector<T> next(size);
    for (int k = int(BITS) - 1; (k) >= 0; --(k)) {
      auto low = next.begin();
      auto high = next.rbegin();
      for (int i = 0; (i) < (int)(size); ++(i)) {
        bits[i] = bool(data[i] & (1ull << k));
        (bits[i] ? *(high++) : *(low++)) = data[i];
      }
      fid[k] = fully_indexable_dictionary(bits);
      zero_count[k] = low - next.begin();
      reverse(next.rbegin(), high);
      data.swap(next);
    }
  }
  uint64_t quantile(int k, int l, int r) {
    assert(0 <= k);
    assert(0 <= l and l <= r and r <= fid[0].size);
    if (r - l <= k) return 1ull << BITS;
    uint64_t acc = 0;
    for (int d = int(BITS) - 1; (d) >= 0; --(d)) {
      int lc = fid[d].rank(1, l);
      int rc = fid[d].rank(1, r);
      int zero = (r - l) - (rc - lc);
      bool p = (k >= zero);
      if (p) {
        acc |= 1ull << d;
        l = lc + zero_count[d];
        r = rc + zero_count[d];
        k -= zero;
      } else {
        l -= lc;
        r -= rc;
      }
    }
    return acc;
  }
};
constexpr int BITS = 30;
int solve(int n, int k, int q, vector<int> const& a) {
  int answer = INT_MAX;
  wavelet_matrix<BITS> wm(a);
  int y0 = wm.quantile(0, 0, n);
  for (int l = 0; (l) < (int)(n); ++(l)) {
    for (int p = 0; (p) < (int)(2); ++(p)) {
      int r = l + k + q - 1 - p;
      if (r <= n) {
        int x = wm.quantile(q - 1, l, r);
        int y = (p ? y0 : wm.quantile(0, l, r));
        chmin(answer, x - y);
      }
    }
  }
  return answer;
}
int main() {
  int n, k, q;
  cin >> n >> k >> q;
  vector<int> a(n);
  for (int i = 0; (i) < (int)(n); ++(i)) cin >> a[i];
  cout << solve(n, k, q, a) << endl;
  return 0;
}
