Snuke has a collection of cards, each with an integer between 1 and N. He has Ai cards with the integer i. Two cards can form a pair if the absolute difference of the integers on them is at most 1. Snuke wants to create the maximum number of pairs without using a card in multiple pairs. Find the maximum number of pairs he can create. Constraints: 1 ≤ N ≤ 10^5, 0 ≤ Ai ≤ 10^9 (1 ≤ i ≤ N). Input format: N, A1, ..., AN. Output: Print the maximum number of pairs Snuke can create. Example: Input: 4, 4, 0, 3, 2. Output: 4. Example pairs: (1,1), (1,1), (3,4), (3,4).

# Buggy version:
import sys

# import re
import math
import collections
# import decimal
import bisect
import itertools
import fractions
# import functools
import copy
import heapq
import decimal
# import statistics
import queue
import numpy as np

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    n = ni()
    ans = 0
    cnt = 0
    for _ in range(n):
        ai = ni()
        if ai == 0:
            ans += n // 2
            n = 0
        else:
            n += ai
    ans += n // 2

    print(ans)


if __name__ == '__main__':
    main()


# Fixed version:
import sys

# import re
import math
import collections
# import decimal
import bisect
import itertools
import fractions
# import functools
import copy
import heapq
import decimal
# import statistics
import queue
import numpy as np

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    n = ni()
    ans = 0
    cnt = 0
    for _ in range(n):
        ai = ni()
        if ai == 0:
            ans += cnt // 2
            cnt = 0
        else:
            cnt += ai
    ans += cnt // 2

    print(ans)


if __name__ == '__main__':
    main()

# Buggy version:
n = int(input())


def f(lst):
  res = 0
  ex = 0
  for a in lst:
    ex += a
    res += ex//2
    ex %= 2
  return res

A = []
ans = 0
for _ in range(n):
  a = int(input())
  if a%2:
    a = 1
  else:
    a = min(a, 2)

  if a!= 0:
    A.append(a)
  elif A:
    ans += max(f(A), f(A[::-1]))
  else:
    continue
print(ans)

# Fixed version:
n = int(input())

def f(lst):
  res = 0
  ex = 0
  for a in lst:
    ex += a
    res += ex//2
    ex %= 2
  return res

A = []
ans = 0
for _ in range(n):
  a = int(input())
  if a%2:
    ans += a//2
    a = 1
  else:
    if a>2:
      ans += a//2-1
      a = 2

  if a!= 0:
    A.append(a)
  elif A:
    ans += max(f(A), f(A[::-1]))
    A = []
  else:
    continue
else:
  ans += max(f(A), f(A[::-1]))
print(ans)

# Buggy version:
n=int(input())
a=[]
ans=0
for i in range(n):
    a.append(int(input()))
    ans+=a[-1]//2
    a[-1]//=2
    if(i>0 and a[-2]==1 and a[-1]==1):
        ans+=1
        a[-2]-=1
        a[-1]-=1

print(ans)


# Fixed version:
n=int(input())
a=[]
ans=0
for i in range(n):
    a.append(int(input()))
    if(i>0 and a[-2]==1 and a[-1]>0):
        ans+=1
        a[-2]-=1
        a[-1]-=1
    ans+=a[-1]//2
    a[-1]=a[-1]%2
    if(i>0 and a[-2]==1 and a[-1]==1):
        ans+=1
        a[-2]-=1
        a[-1]-=1

print(ans)

# Buggy version:
N = int(input())
ans = 0
prev_A = -10
prev_card_num = 0
for i in range(1,N+1):
    A = int(input())
    ans += (prev_card_num + A)//2
    if prev_A == i-1 and (prev_card_num+A)%2 == 1:
        prev_card_num = 1
        prev_A = i
    elif prev_A == i-1 and (prev_card_num+A)%2 == 0:
        prev_card_num = 0
    else:
        prev_card_num = 1
        prev_A = i
print(ans)

# Fixed version:
N = int(input())
ans = 0
prev_A = -10
prev_card_num = 0
for i in range(1,N+1):
    A = int(input())
    ans += (prev_card_num + A)//2
    if prev_card_num == 1 and A == 0:
        prev_card_num = 0
    elif (prev_card_num+A)%2 == 1:
        prev_card_num = 1
        prev_A = i
    else:
        prev_card_num = 0
        prev_A = i
print(ans)

# Buggy version:
N=int(input())
A=[int(input()) for _ in range(N)]
 
ans=0
for i in range(1,N+1):
  if A[i-1]>=A[i]:
    ans+=A[i]
    ans+=(A[i-1]-A[i])//2
    A[i]=0
  else:
    ans+=A[i-1]
    ans+=(A[i]-A[i-1])//2
    A[i]-=A[i-1]
    
print(ans)

# Fixed version:
N = int(input())
A = [int(input()) for _ in range(N)]+[0]

ans = 0
for i in range(N):
    if A[i] % 2 == 0:
        ans += A[i]//2
        A[i] = 0
    else:
        ans += A[i]//2
        if A[i+1] > 0:
            ans += 1
            A[i+1] -= 1
            A[i] = 0
print(ans)

# Buggy version:
n=int(input())
a = [int(input()) for i in range(n)]
a.append(0)
ans = 0
for i in range(n+1):
  if a[i]!=0:
    tmp += a[i]
  else:
    ans += tmp//2
    tmp = 0
print(ans)

# Fixed version:
n=int(input())
a = [int(input()) for i in range(n)]
a.append(0)
ans = 0
tmp = 0
for i in range(n+1):
  if a[i]!=0:
    tmp += a[i]
  else:
    ans += tmp//2
    tmp = 0
print(ans)

# Buggy version:
n=int(input())
l=[0]
for i in range(n):
  l.append(int(input()))
count=0
for i in range(n-1):
  if l[i]%2==1 and l[i+1]>0:
    count+=1
    l[i]-=1
    l[i+1]-=1
for i in range(n):
  count+=l[i]//2
print(count)

# Fixed version:
n=int(input())
l=[]
for i in range(n):
  l.append(int(input()))
count=0
for i in range(n-1):
  if l[i]%2==1 and l[i+1]>0:
    count+=1
    l[i]=l[i]-1
    l[i+1]=l[i+1]-1
for i in range(n):
  count+=l[i]//2
print(count)

# Buggy version:
n=int(input())
ans=0
check=0
for i in range(n):
  s=int(input())
  if i==n-1:
    check+=s
    ans+=check//2
  elif s!=0:
    check+=s
  else:
    ans+=check//2
    check=0
print(check)

# Fixed version:
n=int(input())
ans=0
check=0
for i in range(n):
  s=int(input())
  if i==n-1:
    check+=s
    ans+=check//2
  elif s!=0:
    check+=s
  else:
    ans+=check//2
    check=0
print(ans)

# Buggy version:
def main():
    n = int(input())
    a = [int(input()) for _ in range(n)]
    ans = 0
    for i in range(n):
        if a[i] == 0:
            continue
        ans = a[i]//2
        if i != n-1 and a[i]&1 and a[i+1] != 0:
            ans += 1
            a[i+1] -= 1
    print(ans)
if __name__ == "__main__":
    main()

# Fixed version:
def main():
    n = int(input())
    a = [int(input()) for _ in range(n)]
    ans = 0
    for i in range(n):
        if a[i] == 0:
            continue
        ans += a[i]//2
        if i != n-1 and a[i]&1 and a[i+1] != 0:
            ans += 1
            a[i+1] -= 1
    print(ans)
if __name__ == "__main__":
    main()

# Buggy version:
N=int(input())
l=[]

for i in range(N):
    l.append(int(input()))

ans=0
      
for i in range(N-1):
    ans+=(l[i]-l[i]%2)/2
    l[i]=l[i]%2
    if l[i+1]!=0:
        ans+=l[i]
        l[i+1]-=l[i]
print(ans)
    
    

# Fixed version:
N=int(input())
l=[]

for i in range(N):
    l.append(int(input()))

ans=0
      
for i in range(N-1):
    ans+=(l[i]-l[i]%2)/2
    l[i]=(l[i]%2)
    if l[i+1]!=0:
        ans+=l[i]
        l[i+1]-=l[i]
ans+=(l[-1]-l[-1]%2)/2
print(int(ans))

# Buggy version:
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():

    return

#B
def B():
    n = I()
    a = IR(n)
    ans = 0
    b = [0]*(n+1)
    for i in range(n):
        ans += (a[i]+b[i])>>1
        if (a[i]%2)^(b[i]%2):
            b[i+1] += 1
    print(ans)
    return

#C
def C():

    return

#D
def D():

    return

#E
def E():

    return

#F
def F():

    return

#Solve
if __name__ == "__main__":
    B()


# Fixed version:
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():

    return

#B
def B():
    n = I()
    a = IR(n)
    ans = 0
    b = [0]*(n+1)
    for i in range(n):
        ans += (a[i]+b[i])>>1
        if (a[i]%2)^(b[i]%2) and a[i]:
            b[i+1] += 1
    print(ans)
    return

#C
def C():

    return

#D
def D():

    return

#E
def E():

    return

#F
def F():

    return

#Solve
if __name__ == "__main__":
    B()

# Buggy version:
N = int(input())
A = [int(input()) for _ in range(N)]
ans = A[0] // 2
A[0] = A[0] % 2
for i in range(1, N):
    if A[i-1] + A[i] >= 2:
        ans += 1; A[i] -= 1
    q, r = divmod(A[i], 2); A[i] = r
    ans += q
print(ans)

# Fixed version:
N = int(input())
A = [int(input()) for _ in range(N)]
ans = A[0] // 2
A[0] = A[0] % 2
for i in range(1, N):
    if A[i-1] > 0 and A[i-1] + A[i] >= 2:
        ans += 1; A[i] -= 1
    q, r = divmod(A[i], 2); A[i] = r
    ans += q
print(ans)

# Buggy version:
N = int(input())
A = [int(input()) for i in range(N)]

ans = 0
cnt = 0

for a in A :
    ans += (a+cnt) // 2
    cnt = (a+cnt) % 2

print(ans)


# Fixed version:
N = int(input())
A = [int(input()) for i in range(N)]

ans = 0
cnt = 0

for a in A :
    ans += (a+cnt) // 2
    if a == 0 :
        cnt = 0
    else :
        cnt = (a+cnt) % 2

print(ans)

# Buggy version:
N = int(input())
A = [int(input()) for _ in range(N)]
ans = 0
tmp = 0

for i in A:
    if i != 0:
        tmp += i
    else:
        ans += tmp//2
        tmp = 0

print(ans)

# Fixed version:
N = int(input())
A = [int(input()) for _ in range(N)]
ans = 0
tmp = 0

for i in A:
    if i != 0:
        tmp += i
    else:
        ans += tmp//2
        tmp = 0

ans += tmp//2

print(ans)

# Buggy version:
# -*- coding: utf-8 -*-
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
N = int(input())
L = [int(input()) for _ in range(N)]
ans = 0
prev = 0
for a in L:
    a += prev
    ans += a//2
    prev = a % 2
print(ans)


# Fixed version:
# -*- coding: utf-8 -*-
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
N = int(input())
L = [int(input()) for _ in range(N)]
ans = 0
prev = 0
for a in L:
    if a == 0:
        prev = 0
        continue

    a += prev
    ans += a//2
    prev = a % 2
print(ans)

# Buggy version:
n=int(input())
ans=0
res=0
for i in range(n):
  a=int(input())
  if res==1:
    a+=1
    res=0
  ans+=a//2
  if a%2==1:
    res=1
print(ans)

# Fixed version:
n=int(input())
ans=0
res=0
for i in range(n):
  a=int(input())
  if res==1:
    if a==0:
      res=0
    elif a%2==0:
      ans+=a//2
      res=1
    else:
      ans+=(a+1)//2
      res=0
  else:
    ans+=a//2
    if a%2==1:
      res=1
print(ans)

# Buggy version:
N=int(input())
A=[int(input()) for _ in range(N)]
 
ans=0
for i in range(N):
  if A[i]==0:
    idx.append(i+1)
  
n=0
for iidx in idx:
  ans+=sum(A[n:iidx])//2
  n=iidx
print(ans)

# Fixed version:
N=int(input())
A=[int(input()) for _ in range(N)]

ans=0
idx=[]
for i in range(N):
  if A[i]==0:
    idx.append(i+1)
n=0
idx.append(N)
for iidx in idx:
  ans+=sum(A[n:iidx])//2
  n=iidx
print(ans)

# Buggy version:
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

N = int(input())
A = [int(input()) for _ in range(N)]


ans = 0
tmp = 0
for a in A:
    if a == 0:
        ans += tmp//2
        tmp = 0
    else:
        tmp += a
print(ans)


# Fixed version:
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

N = int(input())
A = [int(input()) for _ in range(N)]
A.append(0)


ans = 0
tmp = 0
for a in A:
    if a == 0:
        ans += tmp//2
        tmp = 0
    else:
        tmp += a
print(ans)

# Buggy version:
s=t=0
for _ in[0]*int(input()):a=int(input());s+=(a+t)//2;t=(a+t)%2&(i>0)
print(s)

# Fixed version:
s=t=0
for _ in[0]*int(input()):a=int(input());s+=(a+t)//2;t=(a+t)%2&(a>0)
print(s)

# Buggy version:
n = int(input())
moto =[]
a = []
for _ in range(n):
  b = int(input())
  moto.append(b)
  if b%2 == 1:
    a.append(1)
  elif b:
    a.append(2)
  else:
    a.append(0)
for i in range(n-1):
  if a[i]%2 == 1:
    a[i+1] += 1
    a[i+1] %=2
  a[i] = 0
print((sum(moto)-sum(a))//2)

# Fixed version:
n = int(input())
moto =[]
a = []
for _ in range(n):
  b = int(input())
  moto.append(b)
  if b%2 == 1:
    a.append(1)
  elif b:
    a.append(2)
  else:
    a.append(0)
for i in range(n-1):
  if a[i]%2 == 1:
    if a[i+1]:
      a[i+1] += 1
      a[i+1] %=2
      a[i]-=1
for i in range(n):
  a[i] %=2
print((sum(moto)-sum(a))//2)

# Buggy version:
n = int(input())
lis = [int(input()) for i in range(n)]
cou = 0
num = 0
for i in range(n):
  if lis[i] == 0:
    cou += (num // 2)
    num = 0
  else:
    num += lis[i]
print(cou)

# Fixed version:
n = int(input())
lis = [int(input()) for i in range(n)]
cou = 0
num = 0
for i in range(n):
  if lis[i] == 0:
    cou += (num // 2)
    num = 0
  else:
    num += lis[i]
cou += (num // 2)
print(cou)

# Buggy version:
t=c=0
for _ in[0]*input():i=input();c+=(i+t)/2;t=i%2&(i>0)
print c

# Fixed version:
t=c=0
for _ in[0]*int(input()):i=int(input());c+=(i+t)//2;t=(i+t)%2&(i>0)
print(c)

# Buggy version:
n = int(input())
a = [int(input()) for _ in range(n)]
ans = 0

for i in range(n-1):
    ans += a[i]//2
    if a[i]%2 == 1 and a[i+1] == 1:
        a[i+1] -= 1
        ans += 1
print(ans)


# Fixed version:
n = int(input())
a = [int(input()) for _ in range(n)]
ans = a[0]//2
for i in range(1,n):
    if a[i]:
        a[i] += a[i-1]%2
    ans += a[i]//2
print(ans)

# Buggy version:
n=int(input())
tmp, ans=0,0
for i in range(n):
  a=int(input())
  if a=0:
    ans+=tmp//2
    tmp=0
  else:
    tmp+=a
print(ans)


# Fixed version:
n = int(input())
tmp,ans = 0,0
for i in range(n):
	a = int(input())
	if a == 0:
		ans += tmp//2
		tmp = 0
	else:
		tmp += a
else:
	ans += tmp//2
print(ans)