#include using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector a(n + 1); for(int i = 0; i < n + 1; i++) { cin >> a[i]; } for(int i = n; i >= 3; i--) { a[i - 2] += a[i]; a[i] = 0; } int x = 0; for(int i = 0; i < n + 1; i++) { if(a[i] != 0) x = i; } cout << x << endl; for(int i = 0; i < n + 1; i++) { if(i <= x) { if(i > 0) cout << " "; cout << a[i]; } } cout << endl; return 0; }