#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, k, q;
  cin >> n >> k >> q;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  int Max = 0;
  for (int i = 0; i + k < n; i++) {
    int m = 1e9;
    for (int j = 0; j < k; j++) {
      m = min(m, a[i + j]);
    }
    Max = max(Max, m);
  }
  sort(a.begin(), a.end());
  cout << min(a[q - 1] - a[0], Max - a[1]) << endl;
}
