#include <fstream>

using namespace std;

void solve( int x1, int x2, int&s1, int&s2) {
	s1 = (x1+x2)/2; s2 = x1-s1;
}

int main () {
	ifstream in;
	in.open("input.txt");

	ofstream out;
	out.open("output.txt");
	
	int signal[256];
	int signal2[256];
	int n,n1;

	in >> n; n1 = n;
	
	for ( int i = 0; i < n; i++) in>> signal[i];

	int k = 1;

	while ( n1!=1) {
		n1 /= 2;
		for(int i = 0; i < k; i++ ) {
			solve ( signal[i], signal[i+k],signal2[i*2],signal2[i*2+1]);
		}

		k *= 2;
		for(int i = 0; i < k; i++ ) signal[i] = signal2[i];
	}
	
	for(int i = 0; i < n; i++ ) out << signal[i]<<' ';


	in.close();
	out.close();
}