{
TASK: LABDARA
LANG: PASCAL
}
program labd;
  const PRF = 'LABDARA.DAT';
        RZF = 'LABDARA.REZ';
  var f1, f2: text;
      i, labdara, mon1, mon2, N: longint;
begin
  assign (f1, PRF);
  reset (f1);
  assign (f2, RZF);
  rewrite (f2);
  readln (f1, N);
  readln (f1, mon1);
  labdara := 0;
  for i := 2 to N do
    begin
      readln (f1, mon2);
      labdara := labdara + (mon1 + mon2) mod 2;
      mon1 := (mon1 + mon2) div 2;
      writeln (f2, mon1);
    end;
   writeln (f2, mon1);
   writeln (f2, labdara);
   close (f2);
   close (f1);
end.
