
var a:array[1..10000]of longint; n,i,f,s:longint;begin for i:=1 to 20 do read(a[i]); for i:=1 to 20 do begin if a[i]=1 then if f<>2 then f:=f+1 else begin if a[i]=1 then a[i]:=0 else a[i]:=1; if a[i-1]=1 then a[i-1]:=0 else a[i-1]:=1; if a[i+1]=1 then a[i+1]:=0 else a[i+1]:=1; s:=s+1; f:=0; end; end; writeln(s);end.
