import Control.Monad
import Data.List
import qualified Data.ByteString.Char8 as BS
main=do
 [n,c,k]<-map read.words<$>getLine
 t<-replicateM n (read.BS.unpack<$>BS.getLine)
 print (f (sort t) c k 0)
  where f [] _ _ i = i
        f (a:t) c k i = (\l->f (drop l t) c k (i+1)) (length(take(c-1)(filter(<=a+k)t)))