#include <bits/stdc++.h>

using namespace std;
int main()
{
	int n,a[1000000];
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	long long sum1=0,sum2=0,sum3=0;
	if(n%2==0)
	{
		for(int i =0;i<n;i=i+2)
		{
			sum1+=a[i];
		}
		for(int i=1;i<n;i = i+2)
		{
			sum2 +=a[i];
		}		
	}
	else
	{
		for(int i=0;i<n-2;i=i+2)
		{
			sum1 +=a[i];	
		}
		for(int i=1;i<n;i = i+2)
		{
			sum2 +=a[i];
		}
		for(int i =2;i<n;i=i+2)
		{
			sum3 +=a[i];
		}		
	}
	long long ans;
	ans = max(sum1,max(sum2,sum3));
	cout<<ans<<endl;
	return 0;	
}