#include <bits/stdc++.h>
using namespace std;
__attribute__((constructor)) void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}
signed main() {
  long long n, k, q;
  vector<long long> a, b;
  cin >> n >> k >> q;
  for (long long i = (0); i < (n); i++) {
    long long x;
    cin >> x;
    a.push_back(x), b.push_back(x);
  }
  long long ans, kmn = 1145141919810, kmx = 0;
  for (long long i = (0); i < (q); i++) {
    long long mn = 1145141919;
    multiset<long long> ms;
    for (long long j = (0); j < (a.size()); j++) {
      ms.insert(a[j]);
      if (ms.size() == k) {
        mn = min(mn, *ms.begin());
        ms.erase(ms.find(a[j - k + 1]));
      }
    }
    for (long long j = (0); j < (a.size()); j++) {
      if (a[j] == mn) {
        a.erase(a.begin() + j);
        kmn = min(kmn, mn);
        kmx = max(kmx, mn);
        break;
      }
    }
  }
  ans = kmx - kmn;
  kmn = 1145141919810, kmx = 0;
  for (long long i = (0); i < (q); i++) {
    long long mx = 0;
    multiset<long long> ms;
    for (long long j = (0); j < (b.size()); j++) {
      ms.insert(b[j]);
      if (ms.size() == k) {
        mx = max(mx, *ms.begin());
        ms.erase(ms.find(b[j - k + 1]));
      }
    }
    for (long long j = (0); j < (b.size()); j++) {
      if (b[j] == mx) {
        b.erase(b.begin() + j);
        kmn = min(kmn, mx);
        kmx = max(kmx, mx);
        break;
      }
    }
  }
  cout << min(ans, kmx - kmn) << endl;
}
