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

class Main {

   Scanner in;
   PrintWriter out;

   final String INPUT_FILE_NAME = "input.txt";
   final String OUTPUT_FILE_NAME = "output.txt";

   

   void solve() {
      int n = in.nextInt();
      int inp[] = new int[1+n];
      for (int i = 1; i <= n; i++){
         inp[i] = in.nextInt();
      }
      
      for (int i = 1; i<= n/2; i*=2 ){
         int ans[] = new int[1+n];
         int c = 0;
         for (int j = 1; j <= i; j++){
            int a = (inp[j]+inp[j+i])/2;
            int b = inp[j]-a;
            ans[j+c] = a;
            c++;
            ans[j+c] = b;
         }
         c++;
         for (int j = 1; j <= i*2; j++){
            inp[j] = ans[j];
         }
         
      }
      for (int i = 1; i<=n; i++){
         out.print(inp[i]+" ");
      }
   }

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

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

   }
}

// class Scanner {
// StreamTokenizer in;
//
// Scanner(Reader r) {
// in = new StreamTokenizer(new BufferedReader(r));
// in.resetSyntax();
// in.whitespaceChars(0, 32);
// in.wordChars(33, 255);
// }
//
// String next() {
// try {
// in.nextToken();
// return in.sval;
// } catch (Exception e) {
// throw new Error();
// }
// }
//
// double nextDouble() {
// return Double.parseDouble(next());
// }
//
// int nextInt() {
// return Integer.parseInt(next());
// }
//
// long nextLong() {
// return Long.parseLong(next());
// }
// }
