import java.util.*; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int d = sc.nextInt(); int[] arr = new int[d + 1]; for (int i = 0; i <= d; i++) { arr[i] = sc.nextInt(); } for (int i = d; i >= 3; i--) { int x = arr[i]; arr[i - 2] += x; arr[i] = 0; } if (arr[2] != 0) { System.out.println(2); System.out.println(arr[0] + " " + arr[1] + " " + arr[2]); } else if (arr[1] != 0) { System.out.println(1); System.out.println(arr[0] + " " + arr[1]); } else { System.out.println(0); System.out.println(arr[0]); } } }