#include <bits/stdc++.h>
#pragma GCC optimize("O3")
template <typename T>
bool uax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool uin(T& a, T b) {
  if (b < a) {
    a = b;
    return true;
  }
  return false;
}
using namespace std;
const int inf = 1e9 + 500500;
void solve_e() {
  int n, k, q;
  cin >> n >> k >> q;
  vector<int> a(n);
  vector<int> d0(n), d1(n);
  for (int i = 0; i < (int)(n); ++i) cin >> a[i];
  int ans = inf;
  vector<int> b(a);
  sort((b).begin(), (b).end());
  b.erase(unique((b).begin(), (b).end()), b.end());
  vector<int> ca(n);
  int ndl = -inf;
  for (int L : b) {
    if (L <= ndl) continue;
    for (int i = 0; i < (int)(n); ++i) ca[i] = i;
    int dl = inf, dr = -inf, dd = 0;
    for (int j = 0; j < (int)(q); ++j) {
      for (int i = 0; i < (int)(n - j); ++i) {
        d0[i] = ca[i];
        if (i % k != 0)
          if (a[d0[i - 1]] < a[d0[i]]) d0[i] = d0[i - 1];
      }
      for (int i = (int)(n - j) - 1; i >= 0; --i) {
        d1[i] = ca[i];
        if (i % k != k - 1 && i + 1 < n - j)
          if (a[d0[i + 1]] < a[d0[i]]) d0[i] = d0[i + 1];
      }
      int bv = inf, bi = -1;
      for (int i = (int)(n - j - k + 1) - 1; i >= 0; --i) {
        int ii = a[d1[i]] < a[d0[i + k - 1]] ? d1[i] : d0[i + k - 1];
        if (a[ii] >= L) {
          if (uin(bv, a[ii])) bi = ii;
        }
      }
      if (0) {
        for (int i = 0; i < (int)(n - j); ++i) cerr << a[ca[i]] << ' ';
        cerr << endl;
        for (int i = 0; i < (int)(n - j); ++i) cerr << a[d0[i]] << ' ';
        cerr << endl;
        for (int i = 0; i < (int)(n - j); ++i) cerr << a[d1[i]] << ' ';
        cerr << endl;
        for (int i = 0; i < (int)(n - j); ++i) cerr << ca[i] << ' ';
        cerr << endl;
        cerr << bv << ' ' << bi << endl;
      }
      if (bi != -1) {
        uin(dl, bv);
        uax(dr, bv);
        dd += 1;
        bi = find(ca.begin(), ca.begin() + n - j, bi) - ca.begin();
        rotate(ca.begin() + bi, ca.begin() + bi + 1, ca.begin() + n - j);
      } else
        break;
    }
    if (dd == q) {
      uax(ndl, dl);
      uin(ans, dr - dl);
    } else
      break;
  }
  cout << ans << endl;
}
void solve_d() {
  int n;
  cin >> n;
  const int M = 20;
  vector<int> a(n);
  for (int i = 0; i < (int)(n); ++i) cin >> a[i];
  array<int, M> b;
  for (int i = 0; i < (int)(M); ++i) b[i] = n;
  vector<int> c(n + 1, n);
  long long ans = 0;
  for (int i = (int)(n)-1; i >= 0; --i) {
    int r = c[i + 1];
    for (int j = 0; j < (int)(M); ++j)
      if ((a[i] >> j) & 1) {
        uin(r, b[j]);
        b[j] = i;
      }
    ans += (c[i] = r) - i;
  }
  cout << ans << endl;
}
void solve_c() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  pair<int, int> a(0, 0);
  for (char c : s)
    if (c == 'W')
      a.second += 1;
    else
      a.first += 1;
  pair<int, int> b(0, 0);
  int ans = n;
  for (char c : s) {
    if (c == 'W')
      a.second -= 1;
    else
      a.first -= 1;
    uin(ans, a.first + b.second);
    if (c == 'W')
      b.second += 1;
    else
      b.first += 1;
  }
  cout << ans << endl;
}
int main() {
  solve_e();
  return 0;
}
