#include <bits/stdc++.h>
int n, k, q, a[2010], b[2010], c[2010], d[2010], ans = 1000000000;
int main() {
  scanf("%d%d%d", &n, &k, &q);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]), b[i] = a[i];
  std::sort(b + 1, b + n + 1);
  for (int y = 1; y <= n; y++) {
    for (int i = 1; i <= n; i++)
      if (a[i] >= b[y])
        c[++c[0]] = a[i];
      else {
        if (c[0] < k) {
          c[0] = 0;
          continue;
        }
        std::sort(c + 1, c + c[0] + 1);
        for (int j = 1, lim = c[0] - k + 1; j <= lim; j++) d[++d[0]] = c[j];
        c[0] = 0;
        continue;
      }
    if (c[0] > 0) {
      std::sort(c + 1, c + c[0] + 1);
      for (int j = 1, lim = c[0] - k + 1; j <= lim; j++) d[++d[0]] = c[j];
      c[0] = 0;
    }
    if (d[0] >= q) {
      std::sort(d + 1, d + d[0] + 1);
      printf("%d\n", d[q] - b[y]);
      return 0;
    }
  }
  printf("Error!\n");
  return 0;
}
