import Data.List fork f (x,y) = (f x, f y) main = do n <- readLn as <- map read . words <$> getLine print (pyramid n as) pyramid n as = length ((ipos n as) \\ (ppos (sum as))) ipos n as = [(x,y) | x <- [1 .. n], y <- [1 .. as!!(x-1)]] ppos x = do let w = floor (sqrt (fromIntegral x)) iy <- [1 .. w] ix <- [iy .. 2*w-iy] return (ix,iy)