import Data.List

main = do
    getLine
    as <- map read . words <$> getContents
    print . fst $ foldl f (0,0) as

f (p,0) k = let (d,m) = k `divMod` 2 in (p+d,m)
f (p,1) 0 = (p,0)
f (p,1) k = let (d,m) = (k-1) `divMod` 2 in (p+d+1,m)