#include <bits/stdc++.h>
using namespace std;
const long long inf = (long long)1e9 + 10;
const long long linf = (long long)1e18 + 10;
const long long mod = (long long)(1e9 + 7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;
long long mop(long long a, long long b) {
  long long res = 1;
  a %= mod;
  assert(b >= 0);
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
struct oreno_initializer {
  oreno_initializer() {
    cin.tie(0);
    ios::sync_with_stdio(0);
  }
} oreno_initializer;
template <typename V>
struct RMQ {
 private:
  int n;
  vector<V> node;

 public:
  explicit RMQ(int sz) {
    n = 1;
    while (n < sz) n *= 2;
    node.resize(2 * n - 1, 1 << 30);
  }
  void update(int x, V val) {
    x += n - 1, node[x] = val;
    while (x > 0)
      x = (x - 1) / 2, node[x] = min(node[2 * x + 1], node[2 * x + 2]);
  }
  V query(int a, int b, int k = 0, int l = 0, int r = -1) {
    if (r < 0) r = n;
    if (r <= a || b <= l) return 1 << 30;
    if (a <= l && r <= b) return node[k];
    return min(query(a, b, 2 * k + 1, l, (l + r) / 2),
               query(a, b, 2 * k + 2, (l + r) / 2, r));
  }
};
template <class T, int ME>
class fbit {
 public:
  T bit[1 << ME], val[1 << ME];
  T total(int e) {
    T s = 0;
    e++;
    while (e) s += bit[e - 1], e -= e & -e;
    return s;
  }
  T add(int e, T v) {
    val[e++] += v;
    while (e <= 1 << ME) bit[e - 1] += v, e += e & -e;
  }
  T set(int e, T v) { add(e, v - val[e]); }
  int lb(T v) {
    T tv = 0;
    int i, ent = 0;
    for (i = ME - 1; i >= 0; i--)
      if (tv + bit[ent + (1 << i) - 1] < v)
        tv += bit[ent + (1 << i) - 1], ent += (1 << i);
    return ent;
  }
};
int n, k, q, a[2020];
RMQ<int> mn(2020), mx(2020);
signed main() {
  cin >> n >> k >> q;
  if (q == 1) return cout << 0 << '\n', 0;
  for (int(i) = (0); (i) < (n); ++(i)) {
    cin >> a[i];
    mn.update(i, a[i]), mx.update(i, a[i]);
  }
  int l = 0, r = inf;
  for (int(x) = (0); (x) < (q); ++(x)) {
    int m = inf, id = 0;
    fbit<int, 11> f;
    for (int(i) = (0); (i) < (n - k + 1 - x); ++(i)) {
      int tl = i, tr = n;
      while (tr - tl > 1) {
        int t = (tr + tl) / 2;
        if (t - i + 1 - f.total(t) > k)
          tr = t;
        else
          tl = t;
      }
      int t = mn.query(i, tl + 1);
      if (m > t) m = t, id = i;
    }
    if ((l) < (m)) (l) = (m);
    if ((r) > (m)) (r) = (m);
    for (int(i) = (id); (i) < (n); ++(i))
      if (mn.query(i, i + 1) == m) {
        mn.update(i, inf);
        f.add(i, 1);
        break;
      }
  }
  int res = r - l;
  l = 0, r = inf;
  for (int(x) = (0); (x) < (q); ++(x)) {
    int m = inf, id = 0;
    fbit<int, 11> f;
    for (int(i) = (0); (i) < (n - k + 1 - x); ++(i)) {
      int tl = i, tr = n;
      while (tr - tl > 1) {
        int t = (tr + tl) / 2;
        if (t - i + 1 - f.total(t) > k)
          tr = t;
        else
          tl = t;
      }
      int t = mx.query(i, tl + 1);
      if (m < t) m = t, id = i;
    }
    if ((l) < (m)) (l) = (m);
    if ((r) > (m)) (r) = (m);
    for (int(i) = (id); (i) < (n); ++(i))
      if (mx.query(i, i + 1) == m) {
        mx.update(i, inf);
        f.add(i, 1);
        break;
      }
  }
  if ((res) > (r - l)) (res) = (r - l);
  cout << -res << '\n';
}
