#include #include #include #include #include using namespace std; #define LL long long int b[10010]; int main(){ int d; cin>>d; for(int i=0;i<=d;i++)cin>>b[i]; for(int i=d;i>=3;i--){ b[i-2]+=b[i]; b[i]=0; } while(d>0&&b[d]==0)d--; cout<