module Main where eval :: Int -> Int -> [Int] -> [Int] eval 0 _ = id eval t d = eval (t - 1) d . filt . (>>= \x -> [x+d, x, x-d]) where filt [] = [] filt (x:xs) = x : filt (filter (/= x) xs) main :: IO () main = do [_, d, t] <- fmap (map read . words) getLine xs <- fmap (map read . words) getLine print $ length $ eval t d xs