import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; public class No40 { public static void main(String[] args) throws IOException{ //多項式の割り算 String[] str = readStr(); int D = Integer.parseInt(str[0]); int[] a = new int[D + 1]; for(int i = 0;i <= D;i++) { a[D - i] = Integer.parseInt(str[1].split(" ")[i]); } for(int i = 0;i < D - 2;i++) { a[i + 2] += a[i]; a[i] = 0; } int Dd = 0; for(int i = Math.max(0, D - 2);i <= D ;i++) { if(a[i] > 0) { Dd = D - i; break; } } System.out.println(Dd); for(int i = D;i >= D - Dd;i--) { System.out.print(a[i]); if(i == D - Dd) { System.out.println(); }else { System.out.print(" "); } } } public static String[] readStr() throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ArrayList list = new ArrayList<>(); do { list.add(br.readLine()); }while(br.ready()); br.close(); String[] text = new String[list.size()]; list.toArray(text); return text; } }