#include using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define srep(i, s, n) for (int i=(s); i < (int)(n); i++) #define all(v) v.begin(), v.end() #define fore(i,x) for(auto i:x) #define pb push_back using vi=vector; using vvi=vector; using vb=vector; using vvb=vector; using vs=vector; using vll=vector; using vvll=vector; using vc=vector; using vvc=vector; using ll=long long; void Yes(bool ok){ cout << (ok ? "Yes" : "No") << "\n";} int main(){ int N; cin >> N; vi V(N); rep(i,N) cin >> V.at(i); vvi dp(N+1,vi(2)); rep(i,N){ dp.at(i+1).at(0)=max(dp.at(i+1).at(0),dp.at(i).at(1)+V.at(i)); dp.at(i+1).at(1)=max(dp.at(i+1).at(1),max(dp.at(i).at(1),dp.at(i).at(0))); } int ans=max(dp.at(N).at(0),dp.at(N).at(1)); cout << ans << "\n"; }