#include <bits/stdc++.h>

using namespace std;
 
#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl
 
typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) (c.begin(),c.end())
#define in(x, a, b) (a <= x && x < b)
const int inf = 1000000001;
const ll INF = 2e18;
const ll MOD = 1000000007;
//const ll mod = 1000000009;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p <<endl;
int dx[4] = { 1,0, -1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);


class LazySegmentTree {
public:
  int n;
  vector<pii> node, lazy;

  LazySegmentTree(vector<pii> a) {
    int _n = a.size();
    n = 1; while (n < _n) n *= 2;
    node.resize(2 * n - 1);
    lazy.resize(2 * n - 1, pii(-2*inf, -2*inf));
    for (int i = 0; i < _n; i++) node[i + n - 1] = a[i];
    for (int i = n - 2; i >= 0; i--) {
      node[i].first = node[i * 2 + 1].first + node[i * 2 + 2].first;
      node[i].second = node[i * 2 + 1].second + node[i * 2 + 2].second;
    }
  }

  // k番目のノードについて遅延評価を行う
  inline void eval(int k, int l, int r) {
    if (lazy[k].first != -2 * inf) {
      node[k].first = (r - l) * lazy[k].first;
      node[k].second = (r - l) * lazy[k].second;
      if (r - l > 1) {
        lazy[2 * k + 1] = lazy[k]; /////
        lazy[2 * k + 2] = lazy[k]; /////
      }
      lazy[k] = pii(-2 * inf, -2*inf);
    }
  }

  // [a, b)をxにする
  void add(int a, int b, pii x, int k, int l, int r) {
    // k 番目のノードに対して遅延評価を行う
    eval(k, l, r);
    if (b <= l || r <= a) return;
    if (a <= l && r <= b) {
      lazy[k] = x;
      eval(k, l, r);
    }
    else {
      add(a, b, x, 2 * k + 1, l, (l + r) / 2);
      add(a, b, x, 2 * k + 2, (l + r) / 2, r);
      node[k].first = node[2 * k + 1].first + node[2 * k + 2].first;
      node[k].second = node[2 * k + 1].second + node[2 * k + 2].second;
    }
  }

  pii getsum(int a, int b, int k, int l, int r) {
    eval(k, l, r);
    if (b <= l || r <= a) return pii(0, 0);
    if (a <= l && r <= b) return node[k];
    pii resl = getsum(a, b, 2 * k + 1, l, (l + r) / 2);
    pii resr = getsum(a, b, 2 * k + 2, (l + r) / 2, r);
    return pii(resl.first + resr.first, resl.second + resr.second);
  }
};

class Bit {
public:
	int n;
	vl bit; // 1-index

	Bit(int _n) { n = _n; bit.resize(n + 1); }


	// [1, i]の和
	ll sum(int i) {
		ll s = 0;
		while (i > 0) {
			s += bit[i];
			i -= i & -i;
		}
		return s;
	}

	//iは1-index
	void add(int i, ll x) {
		while (i <= n) {
			bit[i] += x;
			i += i & -i;
		}
	}

	// bitに入ってる中でx番目に小さい数を求める
	// 1番小さい数はx = 1;
	// bitに3を入れる→add(3, 1), 3を出す→add(3, -1)
	ll min_xth(int x) {
		int left = 0, right = 200000;
		while (left + 1 < right) {
			int mid = (left + right) / 2;
			int temp = sum(mid);
			if (temp < x) {
				left = mid;
			}
			else {
				right = mid;
			}
		}
		return right;
	}

};


int main() {
  int n, k, q;
  cin >> n >> k >> q;
  vi a(n);
  rep (i, n) {
    cin >> a[i];
  }
  vector<pii> ai(n);
  rep (i, n) {
    ai[i].first = a[i]; ai[i].second = i;
  }
  sort(ai.begin(), ai.end());
  vi idx(n);
  rep (i, n) {
    idx[i] = ai[i].second;
  }
  vector<bool> used(n);
  vector<pii> b(n, pii(-1, n));
  int ans = inf;
  rep (i, n) {
    LazySegmentTree lst(b);
    Bit bit(n);
    rep (j, i) {
      used[idx[j]] = true;
      pii now = lst.getsum(idx[j], idx[j] + 1, 0, 0, lst.n);
      lst.add(now.first + 1, idx[j], pii(now.first, idx[j]), 0, 0, lst.n);
      lst.add(idx[j] + 1, now.second, pii(idx[j], now.second), 0, 0, lst.n);
    }
    int cnt = 0;
    int j = i;
    int mi = inf;
    int ma = 0;
    while (cnt < q && j < n) {
      //DEBUG(j);
      //DEBUG(idx[j]);
      //DEBUG(cnt);
      pii now = lst.getsum(idx[j], idx[j] + 1, 0, 0, lst.n);
      int num = bit.sum(now.second) - bit.sum(now.first + 1); 
      if (now.second - now.first - 1 - num < k) {
        used[idx[j]] = true;
        lst.add(now.first + 1, idx[j], pii(now.first, idx[j]), 0, 0, lst.n);
        lst.add(idx[j] + 1, now.second, pii(idx[j], now.second), 0, 0, lst.n);
        j++;
        continue;
      }
      mi = min(mi, a[idx[j]]);
      ma = max(ma, a[idx[j]]);
      cnt++;
      bit.add(idx[j] + 1, 1);
      j++;
    }
    //DEBUG(cnt);
    if (cnt < q) {
      break;
    }
    else {
      ans = min(ma - mi, ans);
    }
  }
  cout << ans << endl;
}
    


Measured memory_bytes: 384