#include <bits/stdc++.h>
using namespace std;
long long n, m, q, i, j, k, num[2005], vis[2005], ans = 1ll << 60, fa[2005],
                                                  mx = 1ll << 55;
vector<long long> seq, seq2, all, pos[2005];
multiset<long long> s[2005], s1;
int find(int x) {
  if (fa[x] == x) return x;
  return fa[x] = find(fa[x]);
}
void merge(int x, int y) {
  x = find(x);
  y = find(y);
  if (x == y) return;
  if (s[x].size() > s[y].size()) swap(x, y);
  fa[x] = y;
  for (__typeof((s[x]).begin()) it = (s[x]).begin(); it != (s[x]).end(); it++)
    s[y].insert(*it);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> m >> q;
  for (i = 1; i <= n; i++) {
    cin >> num[i];
    all.push_back(num[i]);
  }
  sort(all.begin(), all.end());
  all.resize(unique(all.begin(), all.end()) - all.begin());
  for (i = 1; i <= n; i++) {
    fa[i] = i;
    s[i].insert(num[i]);
    num[i] = upper_bound(all.begin(), all.end(), num[i]) - all.begin();
    pos[num[i]].push_back(i);
  }
  for (i = all.size(); i >= 0; i--) {
    for (__typeof((pos[i]).begin()) it = (pos[i]).begin(); it != (pos[i]).end();
         it++) {
      vis[*it] = 1;
      if (vis[(*it) - 1]) merge(*it, (*it) - 1);
      if (vis[(*it) + 1]) merge(*it, (*it) + 1);
      j = find(*it);
      while (s[j].size() >= m) {
        long long x = *s[j].begin();
        s[j].erase(s[j].begin());
        s1.insert(x);
      }
      while (s1.size() >= q) {
        long long x = *s1.rbegin();
        s1.erase(--s1.end());
        mx = min(mx, x);
      }
      ans = min(ans, mx - *s1.begin());
    }
  }
  cout << ans;
  return 0;
}
