#include<iostream>
#include<algorithm>
using namespace std;
int N;
int arr[301] = { 0, };
int dp[301][3] = { 0, };
int main(){
cin>> N;
for(int i = 1; i<=N; i++){
scanf("%d", &arr[i]);
}
if(N < 3){
int ans = 0;
for(int i = 1; i<=N; i++){
ans += arr[i];
}
cout<< ans << endl;
return 0;
}
dp[1][1] = arr[1];
dp[2][1] = arr[2];
dp[2][2] = dp[1][1] + arr[2];
for(int i = 3; i<=N; i++){
dp[i][1] = max(dp[i-2][1], dp[i-2][2]) + arr[i];
dp[i][2] = dp[i-1][1] + arr[i];
}
int ans = 0;
ans = max(dp[N][2] , dp[N][1]);
cout<< ans <<endl;
}