import Control.Monad

main :: IO ()
main = do
  n <- readLn
  a <- replicateM n readLn
  let
    solve m [] = m
    solve m [x] = m + x `div` 2
    solve m (x:y:xs)
      | y == 0 = solve (m+x`div`2) xs
      | x < y  = solve (m+x) ((y-x):xs)
      | odd x  = solve (m+1+x`div`2) ((y-1):xs)
      | otherwise = solve (m+x`div`2) (y:xs)
  print $ solve 0 a
