N,*A=list(map(int,open(0)));p=f=0

for a in A:d,m=divmod(a+f,2);p+=d;f=m&(a>0)

print(p)
N,*A=list(map(int,open(0)));p=f=0

for a in A:p+=(a+f)//2;f=(a+f)%2&(a>0)

print(p)
N, *A = list(map(int, open(0)))
p = f = 0
for a in A:
    d, m = divmod(a + f, 2)
    p += d
    f = m & (a > 0)
print(p)

N, *A = list(map(int, open(0)))
p = f = 0
for a in A:
    p += (a + f) // 2
    f = (a + f) % 2 & (a > 0)
print(p)

-    d, m = divmod(a + f, 2) -    p += d -    f = m & (a > 0) +    p += (a + f) // 2 +    f = (a + f) % 2 & (a > 0)