import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.Scanner;

public class main {
	public static void main(String[] args) throws FileNotFoundException {
		Scanner in = new Scanner(new File("input.txt"));
		PrintWriter out = new PrintWriter(new File("output.txt"));
		int n = in.nextInt();
		int s[] = new int[n+1];
		for (int i = 1;i<=n;i++) s[i] = in.nextInt();
		for (int c=1;c<=(int)n/2;c=c*2) {
			int ns[] = new int[n+1];
			for (int i=1;i<=c;i++) {
				ns[2*i-1] = (int)((s[i]+s[i+c])/2);
				ns[2*i] = (int)((s[i]-s[i+c])/2);
			}
			for (int i=1;i<=2*c;i++) s[i] = ns[i];
		}
		out.print(s[1]);
		for (int i=2;i<=n;i++)
			out.print(" "+s[i]);
		in.close();
		out.flush();
		out.close();
	}
}
