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