N, *A = list(map(int, open(0).read().split()))

ans = 0

for i in range(N):

    q, r = divmod(A[i], 2)

    ans += q

    if r == 0 or i == N - 1:

        continue

    elif A[i + 1] != 0:

        A[i + 1] += 1

print(ans)

N, *A = list(map(int, open(0).read().split()))



r = 0

ans = 0

for a in A:

    if a == 0:

        r = 0

        continue

    q, r = divmod(a + r, 2)

    ans += q

print(ans)

N, *A = list(map(int, open(0).read().split()))
ans = 0
for i in range(N):
    q, r = divmod(A[i], 2)
    ans += q
    if r == 0 or i == N - 1:
        continue
    elif A[i + 1] != 0:
        A[i + 1] += 1
print(ans)

N, *A = list(map(int, open(0).read().split()))
r = 0
ans = 0
for a in A:
    if a == 0:
        r = 0
        continue
    q, r = divmod(a + r, 2)
    ans += q
print(ans)

+r = 0 -for i in range(N): -    q, r = divmod(A[i], 2) +for a in A: +    if a == 0: +        r = 0 +        continue +    q, r = divmod(a + r, 2) -    if r == 0 or i == N - 1: -        continue -    elif A[i + 1] != 0: -        A[i + 1] += 1