inputs = ['0 0 1 0 0 1 0','0 0 0 1 0 0']
def jumpingOnClouds(clouds):
jumps = 0
for i,cloud in enumerate(clouds):
if i%2 and (clouds[i] !=1):
jumps +=1
if(clouds[i] == 1):
jumps +=1
print(jumps)
for cloud_input in inputs:
c = list(map(int, cloud_input.rstrip().split()))
jumpingOnClouds(c)