#include <bits/stdc++.h>
using namespace std;
const int N = 2e3 + 233;
void read(int &x) {
  int f = 1;
  x = 0;
  char ch = getchar();
  while (!isdigit(ch)) (ch == '-' ? f = -1 : 0), ch = getchar();
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  return;
}
int n, K, Q, ans, a[N];
int main() {
  read(n);
  read(K);
  read(Q);
  for (int i = 1; i <= n; ++i) read(a[i]);
  sort(a + 1, a + 1 + n);
  ans = 2e9 + 233;
  ans = min(ans, a[Q] - a[1]);
  printf("%d", ans);
  return 0;
}
