#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n, k, q;
  cin >> n >> k >> q;
  vector<int> a(n);
  for (int i = (0); i < (n); ++i) cin >> a[i];
  map<int, set<int> > mp;
  for (int i = (0); i < (n); ++i) mp[a[i]].emplace(i);
  vector<int> sorted(a);
  sort((sorted).begin(), (sorted).end());
  int ans = sorted[q - 1] - sorted[0];
  if (n - k == 0) {
    cout << ans << '\n';
    return 0;
  }
  set<int> st{-1, n};
  int idx = 0, cnt = n - k + 1;
  for (auto &pr : mp) {
    while (!pr.second.empty()) {
      int mx = 0, val = -1;
      for (int e : pr.second) {
        auto it = st.lower_bound(e);
        int len = *it - *prev(it) - 1, len1 = *it - e - 1,
            len2 = e - *prev(it) - 1;
        int tmp = cnt - max(len - k + 1, 0) + max(len1 - k + 1, 0) +
                  max(len2 - k + 1, 0);
        if (tmp > mx) {
          mx = tmp;
          val = e;
        }
      }
      if (mx < q) {
        cout << ans << '\n';
        return 0;
      }
      st.emplace(val);
      pr.second.erase(val);
      cnt = mx;
      ans = min(ans, sorted[idx + 1 + q - 1] - sorted[idx + 1]);
      ++idx;
      if (n - k == idx) {
        cout << ans << '\n';
        return 0;
      }
    }
  }
  cout << ans << '\n';
  return 0;
}
