#include using namespace std; int D; int a[10001]; int main() { cin >> D; for (int i = 0; i <= D; i++) { cin >> a[i]; } for (int i = D; i >= 3; i--) { a[i - 2] += a[i]; } int DD = 0; for (int i = 2; i > 0; i--) { if (a[i] > 0) { DD = i; break; } } cout << DD << endl; for (int i = 0; i < DD; i++) { cout << a[i] << " "; } cout << a[DD] << endl; return 0; }