import qualified Data.ByteString.Char8 as C
import Data.Maybe 
import Control.Monad
import Data.List

cReadLn :: IO Int
cReadLn = fst . fromJust . C.readInt <$> C.getLine

getParms :: IO [Int]
getParms = map (fst . fromJust . C.readInt) . C.words <$> C.getLine

main :: IO ()
main = do
  [n,c,k] <- getParms -- passengers, maximum num in a bus, and limit time
  ts <- sort <$> replicateM n cReadLn -- i-th passenger's arrival time
  print $ f c k ts

f :: Int -> Int -> [Int] -> Int
f c k ts = solver c k ts 0
  where
    solver _ _ [] n = n
    solver c k ts n = solver c k qs (n+1)
      where p  = inABus c k ts
            qs = drop p ts

overWrap :: Int -> Int -> Int -> Maybe Int
overWrap k t0 t1
  | t0+k < t1 = Nothing
  | otherwise = Just (t0+k-t1)

inABus 
  :: Int -> Int -> [Int] -> Int
inABus c k tt@(t:ts) = length . filter isJust . map (overWrap k t) . take c $ tt