
import Control.Monad
import Data.List
import qualified Data.ByteString.Char8 as BC
import Data.Maybe (fromJust)


main::IO()
main=do
  [n,c,k]<-map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine
  ts <- sort . map (fst . fromJust . BC.readInt) <$> replicateM n BC.getLine
  print $ solve 0 c k ts

solve :: Int -> Int -> Int-> [Int] ->Int
solve c k a tt=solve' a tt
  where
    solve' ::Int->[Int]->Int
    solve' ans []=ans
    solve' ans ts@(t:_)=solve' (ans+1) (f ts)
      where
        f::[Int]->[Int]
        f=if (if length ts>c then ts!!(c-1)else last ts)>(t+k) then (dropWhile (<t+k))else (drop c)
