#include <bits/stdc++.h>
using namespace std;
int n, k, q;
int a[10005];
int b[10005];
bool vis[10005] = {};
void init() {
  scanf("%d%d%d", &n, &k, &q);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  sort(a + 1, a + n + 1);
  b[1] = a[1];
  int t = 1;
  vis[1] = true;
  for (int i = 2; i <= n; i++) {
    int mi = 1e9;
    int duang;
    for (int j = 1; j <= n; j++)
      if (!vis[j]) {
        if (a[j] - b[i - 1] < mi) {
          mi = a[j] - b[i - 1];
          duang = j;
        }
      }
    b[++t] = a[duang];
    vis[duang] = true;
  }
}
void work() { printf("%d\n", a[q] - a[1]); }
int main() {
  init();
  work();
  return 0;
}
