#include #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; using ll = long long; using pii = pair; int dp[1005][2]; int main() { int n; cin >> n; rep(i, n) { int v; cin >> v; dp[i + 1][0] = max(dp[i][0], dp[i][1]); dp[i + 1][1] = dp[i][0] + v; } cout << max(dp[n][0], dp[n][1]) << endl; return 0; }