#include<iostream>
#include<cstdio>
using namespace std;
long long n,num[100001],total[100001];
long long all,ans;
int mini(int a,int b){return a<b?a:b;}
int makusu(int a,int b){return a>b?a:b;}
int main()
{
freopen("circlea.in","r",stdin);
freopen("circlea.out","w",stdout);
cin>>n;
int i;
for(i=0;i<n;i++) {cin>>num[i];all+=num[i];}
int mid=n/2-1;
for(i=0;i<=mid;i++) total[0]+=num[i];
for(i=0;i<n;i++)
total[i+1]=total[i]+num[(mid+i+1)%n]-num[i];
for(i=0;i<n;i++)
ans=makusu(ans,mini(total[i],all-total[i]));
cout<<ans<<endl;
return 0;
}