#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
const int maxN = 2005;
int a[maxN], N, K, Q;
int main() {
  cin >> N >> K >> Q;
  for (int i = 1; i <= N; ++i) cin >> a[i];
  sort(a + 1, a + 1 + N);
  int ans = inf;
  for (int i = Q; i <= N; ++i) ans = min(ans, a[i] - a[i - Q + 1]);
  cout << ans << endl;
}
