#include <bits/stdc++.h>
using namespace std;
template <class T>
bool chmax(T& a, const T& b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T& a, const T& b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
void func(long long N, long long K, long long Q, std::vector<long long> A) {
  set<long long int> s;
  long long int cnt = 0;
  while (1) {
    if (s.size() >= Q) break;
    long long int minNum = (1LL << 50);
    long long int minIndex = 0;
    for (int i = 0; i < K; i++)
      if (chmin(minNum, A[i])) minIndex = i;
    bool execute = true;
    for (int i = 1; i < A.size() - K + 1; i++) {
      long long int minNum2 = (1LL << 50);
      for (int j = 0; j < K; j++) chmin(minNum2, A[i + j]);
      if (minNum != minNum2) execute = false;
    }
    if (!execute) break;
    s.insert(minNum);
    A.erase(A.begin() + minIndex);
  }
  sort(A.begin(), A.end());
  long long int leftS = Q - s.size();
  for (int i = 0; i < leftS; i++) {
    s.insert(A[i]);
  }
  auto itr = s.begin();
  auto itr2 = s.rbegin();
  cout << abs((*itr) - (*itr2)) << endl;
}
int main() {
  long long N;
  scanf("%lld", &N);
  long long K;
  scanf("%lld", &K);
  long long Q;
  scanf("%lld", &Q);
  std::vector<long long> A(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &A[i]);
  }
  func(N, K, Q, std::move(A));
  return 0;
}
