#include #include #include using namespace std; #define REP(i, n) for(int(i)=0;(i)<(n);++(i)) #define FOR(i, f, t) for(int(i)=(f);(i)<(t);(++i)) int n[10010]; int main(){ int N; cin >> N; N++; REP(i,N) cin >> n[N-i-1]; REP(i,N-3){ n[i+2] += n[i]; n[i] = 0; } //REP(i,N) cerr << n[i] << " "; cerr << endl; FOR(i,N-3,N){ if(n[i] || i == N-1){ cout << N-i-1 << endl << n[i]; FOR(j,i+1,N) cout << " " << n[j]; cout << endl; break; } } return 0; }