#include<bits/stdc++.h>
using namespace std;
#define int long long
int32_t main(){
	
	int n;
	cin>>n;
	int a[n+1];
	for(int i=0;i<n;i++) cin>>a[i];
	int dp[n+1];
	dp[n-1] = a[n-1];
	for(int i=n-3;i>=0;i=i-2){
		dp[i] = dp[i+2] + a[i];
	}
	if(n>=2)dp[n-2] = a[n-2];
	for(int i=n-4;i>=0;i=i-2) dp[i] = dp[i+2] + a[i];
	if(n%2==0) cout<<max(dp[0],dp[1]);
else{
	int ans = dp[2];
	for(int i=1;i<n-2;i++){
		ans = max(ans,dp[i+2] + dp[i-1] - dp[i+1]);
	}
	cout<<ans;
}
	return 0;
}