#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
const i64 MOD = 1e9 + 7;
const i64 INF = 1e18 + 7;
signed main() {
  i64 n, k, q;
  cin >> n >> k >> q;
  vector<i64> a(n);
  for (auto& x : a) cin >> x;
  auto b = a;
  sort(b.begin(), b.end());
  b.erase(unique(b.begin(), b.end()), b.end());
  auto f = [&](i64 t) {
    vector<vector<i64>> v(1, vector<i64>(0));
    for (auto& x : a) {
      if (x >= t)
        v.back().emplace_back(x);
      else if (!v.back().empty())
        v.emplace_back(0);
    }
    if (v.back().empty()) v.pop_back();
    for (auto& w : v) {
      w.emplace_back(0);
      sort(w.begin(), w.end());
      w.resize(max(0L, (i64)w.size() - k + 1));
      if (w.empty()) w.emplace_back(0);
    }
    vector<i64> dp(1, 0);
    i64 ns = 0;
    for (auto& w : v) {
      i64 ne = ns + w.size();
      vector<i64> nex(ne + 1, INF);
      for (i64 i = 0; i <= ns; ++i)
        for (i64 j = 0; j < w.size(); ++j)
          nex[i + j] = min(nex[i + j], max(dp[i], w[j]));
      ns = ne;
      dp = move(nex);
    }
    i64 ret = ns < q ? INF : dp[q];
    return ret;
  };
  i64 ans = INF;
  for (auto& x : b) ans = min(ans, f(x) - x);
  cout << ans << endl;
}
