program Project1;

var f, g:textfile;
    n, m, k, i:integer;
    a, b, x, y:longint;
    mas, tmp:array[1..300] of integer;


begin
    assign(f, 'input.txt');
    reset(f);
    read(f, n);
    for i:=1 to n do
      read(f, mas[i]);
    close(f);

    m:=n div 2;
    k:=1;
    while k<=m do begin
      for i:=1 to k do begin
        a:=mas[i];
        b:=mas[k+i];
        x:=(a+b) div 2;
        y:=a-x;
        tmp[i*2-1]:=x;
        tmp[i*2]:=y;
      end;
      for i:=1 to k*2 do
        mas[i]:=tmp[i];
      k:=k*2;
    end;
    assign(g, 'output.txt');
    rewrite(g);
    for i:=1 to n do begin
      write(g, mas[i]);
      if i<>n then write(g, ' ');
    end;
    close(g);
end.
 