#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define FOR(I,A,B) for(int I = (A); I < (B); ++I) typedef long long ll; int main(){ int D; cin >> D; int ans[D+1]; FOR(i,0,D+1) cin >> ans[i]; if(D == 0){ cout << 0 << endl; return 0; } for (int i = D; i >= 3; i--){ ans[i-2] += ans[i]; ans[i] = 0; } int num = 3; for (int i = 2; i >= 0; i--){ if(ans[i] == 0) num--; else break; } cout << (num != 0 ? num - 1 : num) << endl; FOR(i,0,num) { printf("%d%c", ans[i], i == num - 1 ? '\n' : ' '); } return 0; }