local mfl, mce, mmi = math.floor, math.ceil, math.min
local SegTree = {}
SegTree.updateAll = function(self)
  for i = self.stagenum - 1, 1, -1 do
    for j = 1, self.cnt[i] do
      self.stage[i][j] = self.func(self.stage[i + 1][j * 2 - 1], self.stage[i + 1][j * 2])
    end
  end
end
SegTree.create = function(self, n, func, emptyvalue)
  self.func, self.emptyvalue = func, emptyvalue
  local stagenum, mul = 1, 1
  self.cnt, self.stage, self.size = {1}, {{}}, {}
  while mul < n do
    mul, stagenum = mul * 2, stagenum + 1
    self.cnt[stagenum], self.stage[stagenum] = mul, {}
  end
  for i = 1, stagenum do self.size[i] = self.cnt[stagenum + 1 - i] end
  self.stagenum = stagenum
  for i = 1, mul do self.stage[stagenum][i] = emptyvalue end
  self:updateAll()
end
SegTree.getRange = function(self, left, right)
  if left == right then return self.stage[self.stagenum][left] end
  local start_stage = 1
  while right - left + 1 < self.size[start_stage] do
    start_stage = start_stage + 1
  end
  local ret = self.emptyvalue
  local t1, t2, t3 = {start_stage}, {left}, {right}
  while 0 < #t1 do
    local stage, l, r = t1[#t1], t2[#t1], t3[#t1]
    table.remove(t1) table.remove(t2) table.remove(t3)
    local sz = self.size[stage]
    if (l - 1) % sz ~= 0 then
      local newr = mmi(r, mce((l - 1) / sz) * sz)
      table.insert(t1, stage + 1) table.insert(t2, l) table.insert(t3, newr)
      l = newr + 1
    end
    if sz <= r + 1 - l then
      ret = self.func(ret, self.stage[stage][mce(l / sz)])
      l = l + sz
    end
    if l <= r then
      table.insert(t1, stage + 1) table.insert(t2, l) table.insert(t3, r)
    end
  end
  return ret
end
SegTree.setValue = function(self, idx, value, silent)
  self.stage[self.stagenum][idx] = value
  if not silent then
    for i = self.stagenum - 1, 1, -1 do
      local dst = mce(idx / 2)
      local rem = dst * 4 - 1 - idx
      self.stage[i][dst] = self.func(self.stage[i + 1][idx], self.stage[i + 1][rem])
      idx = dst
    end
  end
end
SegTree.setRange = function(self, left, right, value)
  for idx = left, right do
    self.stage[self.stagenum][idx] = value
  end
  for i = self.stagenum - 1, 1, -1 do
    left, right = mce(left / 2), mce(right / 2)
    for j = left, right do
      self.stage[i][j] = self.func(self.stage[i + 1][j * 2 - 1], self.stage[i + 1][j * 2])
    end
  end
end
SegTree.lower_bound = function(self, val)
  local ret, retpos = self.emptyvalue, 0
  local stage, l, r = 1, 1, self.size[1]
  while true do
    local sz = self.size[stage]
    local tmp = self.func(ret, self.stage[stage][mce(l / sz)])
    if tmp < val then
      ret, retpos = tmp, l + sz - 1
      if l + sz <= r then stage, l = stage + 1, l + sz
      else break
      end
    else
      if sz ~= 1 then stage, r = stage + 1, l + sz - 2
      else break
      end
    end
  end
  return retpos + 1
end
SegTree.right_bound = function(self, val, left, right)
  local ret, retpos = self.emptyvalue, left - 1
  local t1, t2, t3 = {1}, {left}, {right}
  while 0 < #t1 do
    local stage, l, r = t1[#t1], t2[#t1], t3[#t1]
    table.remove(t1) table.remove(t2) table.remove(t3)
    local sz = self.size[stage]
    while (l - 1) % sz ~= 0 or r + 1 - l < sz do
      stage = stage + 1
      sz = self.size[stage]
    end
    local tmp = self.func(ret, self.stage[stage][mce(l / sz)])
    if tmp > val then
      ret, retpos = tmp, l + sz - 1
      if retpos == right then break end
      if l + sz <= r then table.insert(t1, 1) table.insert(t2, l + sz) table.insert(t3, r) end
    else
      if sz ~= 1 then table.insert(t1, stage + 1) table.insert(t2, l) table.insert(t3, l + sz - 2) end
    end
  end
  return retpos + 1
end
SegTree.left_bound = function(self, val, left, right)
  local ret, retpos = self.emptyvalue, right + 1
  local t1, t2, t3 = {1}, {left}, {right}
  while 0 < #t1 do
    local stage, l, r = t1[#t1], t2[#t1], t3[#t1]
    table.remove(t1) table.remove(t2) table.remove(t3)
    local sz = self.size[stage]
    while r % sz ~= 0 or r + 1 - l < sz do
      stage = stage + 1
      sz = self.size[stage]
    end
    local tmp = self.func(ret, self.stage[stage][mfl(r / sz)])
    if tmp > val then
      ret, retpos = tmp, r - sz + 1
      if l + sz <= r then table.insert(t1, 1) table.insert(t2, l) table.insert(t3, r - sz) end
    else
      if sz ~= 1 then table.insert(t1, stage + 1) table.insert(t2, r - sz + 2) table.insert(t3, r) end
    end
  end
  return retpos - 1
end
SegTree.new = function(n, func, emptyvalue)
  local obj = {}
  setmetatable(obj, {__index = SegTree})
  obj:create(n, func, emptyvalue)
  return obj
end

local n, k, q = io.read("*n", "*n", "*n")
local a = {}
local t = {}
local rank = {}
for i = 1, n do
  a[i] = io.read("*n")
  t[i] = i
  rank[i] = 0
end
table.sort(t, function(x, y) return a[x] < a[y] end)
for i = 1, n do
  rank[t[i]] = i
end
-- availability (1 or 0) by array index
local stFlag = SegTree.new(n, function(x, y) return x * y end, 1)
for i = 1, n do
  stFlag:setValue(i, 1, true)
end
stFlag:updateAll()
-- available counts by sorted array index
local stCnt = SegTree.new(n, function(x, y) return x + y end, 0)
for i = 1, n do
  stCnt:setValue(i, 1, true)
end
stCnt:updateAll()
local ret = a[t[q]] - a[t[1]]

for i_sorted = 1, n do
  if stCnt:getRange(i_sorted, i_sorted) == 1 then
    stCnt:setValue(i_sorted, 0)
    local idx = t[i_sorted]
    stFlag:setValue(idx, 0)
    local rb = idx == n and n or stFlag:right_bound(0, idx + 1, n)
    if rb - (idx + 1) < k then
      if idx + 1 < rb then
        stFlag:setRange(idx + 1, rb - 1, 0)
        for j = idx + 1, rb - 1 do
          stCnt:setValue(rank[j], 0)
        end
      end
    end
    local lb = idx == 1 and 1 or stFlag:left_bound(0, 1, idx - 1)
    if idx - 1 - lb < k then
      if lb < idx - 1 then
        stFlag:setRange(lb + 1, idx - 1, 0)
        for j = lb + 1, idx - 1 do
          stCnt:setValue(rank[j], 0)
        end
      end
    end
    local p1, p2 = stCnt:lower_bound(1), stCnt:lower_bound(q)
    if n < p2 then
      break
    else
      ret = mmi(ret, a[t[p2]] - a[t[p1]])
    end
  end
end
print(ret)
