program Project1;
var
 voda:array[0..100] of integer;
   stena:array[1..100] of integer;
   i,v,h,n,x,zb,zap:integer;
{$mode objfpc}{$H+}
begin

  for i:=1 to n do
      begin
        voda[i]:=1;
      end;
  voda[0]:=-1;
  voda[n+1]:=-1;
  for v:=1 to h do
      zb:=0;
  zap:=1;
      begin
        for i:=1 to n do
            begin
              read(stena[i]);
              if (stena[i]=1) then
                 begin
                    if v mod 2 = 1 then
                         begin
                            if voda[zap-1] =-1 then voda[i]:=voda[i]+zb else
                                                                        begin
                                                                           if zb mod 2=1 then
                                                                              begin
                                                                                 voda[zap]:=voda[zap]+ 1;
                                                                                zb:=zb-1;;
                                                                      end;
                                                                      if zb mod 2=0 then
                                                                          begin
                                                                          voda[i]:=voda[i]+zb  ;
                                                                          voda[zap]:=voda[zap]+zb;
                                                                      end;
                                                                      end;
                         end else
                             begin
                               if voda[zap+x+1]=-1 then
                                   begin
                                   voda[zap]:=voda[zap]+x ;
                                   x:=0;
                                   end
                               else
                                                                        begin
                                                                           if zb mod 2=1 then
                                                                              begin
                                                                                 voda[i]:=voda[i]+ 1;
                                                                                zb:=zb-1;;
                                                                      end;
                                                                      if zb mod 2=0 then
                                                                          begin
                                                                          voda[i]:=voda[i]+zb  ;
                                                                          voda[zap]:=voda[zap]+zb;
                                                                      end;
                                                                      end;
                             end;
                 zap:=i;

                 end else
                     begin
                       zb:=zb+1;
                       voda[i]:=0;
                       x:=zb;
                     end
            end;
      end;
      for i:=1 to n do write(voda[i],' ');
end.