#include <stdio.h>
#include <iostream>
#include <cmath>
using namespace std;
int m[20][1000];
int step[] = {1,2,4,8,16,32,64,128,256,512,1024};
void decode(int ss, int pos)
{
	for (int i = 0; i < step[ss]; i++)
	{
		int s = m[ss][pos+i];
		int r = m[ss][pos+i+step[ss]];
		m[ss+1][pos+i*2] = (s+r)/2;
		m[ss+1][pos+i*2+1] = (s-r)/2;
	}
}

int main()
{
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	int l;
	cin >> l;
	for (int i = 0; i < l; i++)
		cin >> m[0][i];
	int ss = 0;
	for (; step[ss+1] <= l; ss++)
	{
		//int k = l / step[ss+1];
		//for (int i = 0; i < k; i++)
		decode (ss, 0);
		for (int i = step[ss+1]; i < l; i++)
			m[ss+1][i] = m[ss][i];
	}
	for (int i = 0; i < l; i++)
		cout << m[ss][i] << ' ' ;
	return 0;
}