import java.io.*;
import java.util.*;

public class Main {

	Scanner in;
	PrintWriter out;

	void solve() {
		int n=in.nextInt();
		int ch[]=new int[n+1];
		int ch1[]=new int[n+1];
		for(int i=1;i<=n;i++){
			ch[i]=in.nextInt();
		}
//		for(int k=1;k<=n;k++){
//			out.print(ch[k]+" ");
//		}
		int i=2;
		for(int j=1;j<=n;j++){
			ch1[j]=ch[j];
		}
		while(i<=n){
			for(int j=1;j<=i/2;j++){
				ch1[2*j-1]=(ch[j]+ch[i/2+j])/2;
				ch1[2*j]=(ch[j]-ch[i/2+j])/2;
			}
			for(int k=1;k<=n;k++){
				ch[k]=ch1[k];
			}
			i*=2;
		}
//			out.println();
		for(int k=1;k<=n;k++){
			out.print(ch1[k]+" ");
		}
	}

	void run() {
		try {
			in = new Scanner(new FileReader("input.txt"));
			out = new PrintWriter("output.txt");
		} catch (IOException e) {
			throw new Error(e);
		}
		try {
			solve();
		} finally {
			out.close();
		}
	}

	public static void main(String args[]) {
		new Main().run();
	}

}
