#include #include #include #include #include #include #define MAX_N 1000 int v[MAX_N]; int dp[MAX_N]; int limit; int sushi(int n, bool last){ int val; if(limit <= n) return 0; else if(last == true) val = sushi(n+1, false); else val = std::max(sushi(n+1,false), sushi(n+1,true) + v[n]); return (dp[n] = val); } int main(){ memset(dp,-1,sizeof(dp)); std::cin >> limit; for(register int i = 0; i < limit; i++){ std::cin >> v[i]; } printf("%d\n",sushi(0,false)); }