#include using namespace std; using ll = long long; using vi = vector; using vb = vector; using vd = vector; using vl = vector; using vvi = vector; using vvb = vector; using vvd = vector; using vvl = vector; #define REP(i,n) for(ll i=0; i<(n); ++i) int main() { ll d; cin >> d; vl a(d + 1); REP(i, d + 1) cin >> a[i]; for (ll i = d; i >= 3; --i) a[i - 2] += a[i]; ll nd = a[2] != 0 ? 2 : a[1] != 0 ? 1 : 0; cout << nd << endl; REP(i, nd) cout << a[i] << " "; cout << a[nd] << endl; return 0; }