#include using namespace std; #define REP(i, n) for(int(i)=0;(i)<(n);++(i)) int n[10010]; int main(){ int N; cin >> N; N++; REP(i,N) cin >> n[i]; for(int i = N-1; i >= 3; i--) n[i-2] += n[i], n[i] = 0; int i = 2; while(n[i] == 0) i--; cout << i << endl; REP(j,i) cout << n[j] << " "; cout << n[i] << endl; }