#include using namespace std; using ll = long long; using ld = long double; const ld pi = 3.14159265358979; const int mod = 1000000007; int main(){ int n; cin >> n; vector v(n + 1 , 0); for(int i = 0; i < n; i++){ cin >> v[i]; } vector dp(n + 1 , 0); dp[0] = v[0]; dp[1] = v[1]; for(int i = 0; i <= n; i++){ for(int j = i + 2; j <= n; j++){ if(j <= n)dp[j] = max(dp[j] , dp[i] + v[j]); } } cout << max(dp[n - 1] , dp[n]) << endl; return 0; }