import           Control.Monad
import qualified Data.ByteString.Char8       as BS
import           Data.Maybe
import qualified Data.Vector.Unboxed         as V
import qualified Data.Vector.Unboxed.Mutable as VM

readInt = fst . fromJust . BS.readInt
getInt = readInt <$> BS.getLine

main = do
  n <- getInt

  as <- VM.new (n+1)
  VM.write as n (0::Int)

  forM_ [0..(n-1)] $ \i -> do a <- getInt
                              VM.write as i a
  let solve i npairs | i == n = return npairs
                     | otherwise = do
                         ai <- VM.read as i
                         ai1 <- VM.read as (i+1)
                         if ai >= 2
                           then do let m = ai `div` 2
                                   VM.write as i (ai-2*m)
                                   solve i (npairs + m)
                           else if ai == 1 && ai1 > 0
                                then do VM.write as i (0::Int)
                                        VM.write as (i+1) (ai1 - 1)
                                        solve (i+1) (npairs+1)
                                else solve (i+1) npairs

  ans <- solve 0 0
  print ans