#include <bits/stdc++.h>
using namespace std;
template <class T>
struct SegmentTree {
 private:
  int n;
  vector<T> node;
  T def;
  function<T(T, T)> lop;
  function<T(T, T)> out;

 public:
  SegmentTree() {}
  SegmentTree(const vector<T> &v, T _def, function<T(T, T)> _lop,
              function<T(T, T)> _out) {
    int vl = (int)v.size();
    n = 1;
    while (n < vl) n *= 2;
    def = _def;
    lop = _lop;
    out = _out;
    node = vector<T>(2 * n - 1, def);
    for (int i = 0; i < vl; i++) node[i + n - 1] = v[i];
    for (int i = n - 2; i >= 0; i--)
      node[i] = out(node[i * 2 + 1], node[i * 2 + 2]);
  }
  void update(int idx, T val) {
    idx += (n - 1);
    node[idx] = lop(node[idx], val);
    while (idx > 0) {
      idx = (idx - 1) / 2;
      node[idx] = out(node[idx * 2 + 1], node[idx * 2 + 2]);
    }
  }
  T query(int a, int b, int k = 0, int l = 0, int r = -1) {
    if (r < 0) r = n;
    if ((r <= a) || (b <= l)) return def;
    if ((a <= l) && (r <= b)) return node[k];
    return out(query(a, b, 2 * k + 1, l, (l + r) / 2),
               query(a, b, 2 * k + 2, (l + r) / 2, r));
  }
};
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  const long long inf = LONG_LONG_MAX / 2 - 1;
  long long n, k, q;
  cin >> n >> k >> q;
  vector<long long> a(n);
  for (long long i = 0, i_len = (n); i < i_len; i++) cin >> a[i];
  vector<pair<long long, long long>> ai(n);
  for (long long i = 0, i_len = (n); i < i_len; i++) ai[i] = make_pair(a[i], i);
  auto lop = [](pair<long long, long long> a, pair<long long, long long> b) {
    return b;
  };
  auto out = [](pair<long long, long long> a, pair<long long, long long> b) {
    return min(a, b);
  };
  SegmentTree<pair<long long, long long>> st(ai, make_pair(inf, inf), lop, out);
  long long left = LONG_LONG_MAX, right = LONG_LONG_MIN;
  for (long long i = 0, i_len = (q); i < i_len; i++) {
    pair<long long, long long> tmp = make_pair(inf, inf);
    for (long long j = 0, j_len = (n - k + 1); j < j_len; j++) {
      pair<long long, long long> p = st.query(j, j + k);
      if (p.first < tmp.first) {
        tmp = p;
      }
    }
    left = min(left, tmp.first);
    right = max(right, tmp.first);
    st.update(tmp.second, make_pair(inf, tmp.second));
  }
  cout << (right - left) << "\n";
  return 0;
}
