import java.io._
import java.util.StringTokenizer
import scala.util.control.Breaks.{breakable,break}

object Main extends App {
  val in = new InputReader(System.in)
  val pw = new PrintWriter(System.out)

  val N, K, _Q = in.next().toInt
  val Q = _Q - 1
  val A = new Array[Int](N+1)

  for(i <- 1 to N)
    A(i) = in.next().toInt

  
  //
  def calc(min: Int, ind: Int): Option[Int] = {
    var acc: List[Int] = Nil

    var l = 1; var r = 1
    while(r <= N) {
      if(A(r) < min) {
        val range =
          if (l <= ind && ind <= r - 1) r - l - 1
          else r - l
        if(range >= K) {
          val tmp: Array[Int] = A.slice(l, r).sorted
          val hoge: List[Int] =
            if (l <= ind && ind <= r - 1)
              tmp.slice(1, Math.min(Q, range - (K-1)) + 1).toList
            else
              tmp.take(Math.min(Q, (r-l) - (K-1))).toList
          acc = hoge ++ acc
        }

        r += 1
        l = r
      }
      else {
        r += 1
      }
    }

    val range =
      if (l <= ind && ind <= r - 1) r - l - 1
      else r - l
    if(range >= K) {
      val tmp: Array[Int] = A.slice(l, r).sorted
      val hoge: List[Int] =
        if (l <= ind && ind <= r - 1)
          tmp.slice(1, Math.min(Q, range - (K-1)) + 1).toList
        else
          tmp.take(Math.min(Q, (r-l) - (K-1))).toList
      acc = hoge ++ acc
    }


    //
    if(acc.length >= Q) {
      val tmp = acc.sorted.apply(Q-1)
      // println(tmp, min)
      Some(tmp - min)
    }
    else {
      None
    }
  }


  var ans = Int.MaxValue
  for(i <- 1 to N) {
    val tmp = calc(A(i), i)
    tmp match {
      case Some(x) => ans = Math.min(ans, x)
      case None => ()
    }
  }

  println(ans)
}


class InputReader(stream: InputStream) {
  private val reader = new BufferedReader(new InputStreamReader(stream))
  private var tokenizer: StringTokenizer = new StringTokenizer(reader.readLine())
  def next(): String = {
    while (!tokenizer.hasMoreTokens()) {
      tokenizer = new StringTokenizer(reader.readLine())
    }
    tokenizer.nextToken()
  }
}

