// 
#pragma comment(linker, "/STACK:16777215")
#include <cmath>
#include <cstring>
#include <ctime>
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <deque>
#include <string>
using namespace std;

int n;
vector<int> mas;
vector<int> res;
int main()
{
	int i, j, k;
	int a, b;
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	cin >> n;
	mas.resize(n+1, 0);
	for(i=1; i<=n; ++i)
		cin>> mas[i];
	
	for(i=1; i*2<=n; i*=2)
	{
		res.resize(0);
		for(j=1; j<=i; j++)
		{
			a= (mas[j]-mas[j+i])/2;
			b= (mas[j+i]+mas[j])/2;
			res.push_back(b);
			res.push_back(a);
		}
		for(j=1; j<=2*i; j++)
			mas[j]= res[j-1];
	}
	for(i=1; i<=n; ++i)
		cout<< mas[i] << ' ';
	return 0;
}