#include <bits/stdc++.h>
using namespace std;
int N, K, Q, Mx, Mn = 2e9;
int A[2005];
bool vis[2005];
int main() {
  scanf("%d%d%d", &N, &K, &Q);
  for (int i = 1; i <= N; i++) scanf("%d", &A[i]);
  for (int i = 1; i <= Q; i++) {
    int Min = 2e9, id = 0;
    for (int j = 1; j <= N; j++)
      if (A[j] < Min && !vis[j]) Min = A[j], id = j;
    vis[id] = 1;
    Mn = min(Min, Mn);
    Mx = max(Min, Mx);
  }
  printf("%d\n", Mx - Mn);
  return 0;
}
