import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; class Main { static PrintWriter out = new PrintWriter(System.out); static String str; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int d = Integer.parseInt(br.readLine()); String[] num = br.readLine().split(" "); br.close(); int[] result = new int[d - 1]; PrintWriter out = new PrintWriter(System.out); int i; if (d < 3) { out.println(d); for (i = 0; i < d; i++) { out.print(num[i] + " "); } out.println(num[i]); } else { int[] tmp = new int[d + 1]; for (i = 0; i < d + 1; i++) { tmp[i] = Integer.parseInt(num[i]); if (i < d - 1) { result[i] = tmp[i]; } } result[d - 2] -= -tmp[d]; result[d - 3] -= -tmp[d - 1]; for (i = d-2; i >= 3; i--) { result[i-2] -= -result[i]; result[i]=0; } int point = 0; for (i = 0; i < d - 1; i++) { if (result[i] != 0) { point = i; } } out.println(point); for (i = 0; i < point; i++) { out.print(result[i] + " "); } out.println(result[i]); } out.flush(); } }