#include using namespace std; using ll = long long; #define rep(i, s, e) for (int i = (int)s; i < (int)e; ++i) #define all(a) (a).begin(), (a).end() int main() { cin.tie(nullptr); int N; cin >> N; vector dp(N, vector(2)); vector V(N); rep(i, 0, N) cin >> V[i]; dp[0][0] = V[0]; dp[0][1] = 0; rep(i, 1, N) { dp[i][0] = dp[i - 1][1] + V[i]; dp[i][1] = max(dp[i - 1][0], dp[i - 1][1]); } cout << max(dp[N - 1][0], dp[N - 1][1]) << '\n'; }