#include <stdio.h>

long long ans_even(int N, int A[])
{
	int i;
	long long odd[100001], even[100001], ans = -((long long)1 << 60);
	for (i = 1, odd[0] = 0; i <= N / 2; i++) odd[i] = odd[i-1] + A[i*2-1];
	for (i = 1, even[0] = 0; i <= N / 2; i++) even[i] = even[i-1] + A[i*2];
	for (i = 0; i <= N / 2; i++) if (odd[i] + even[N/2] - even[i] > ans) ans = odd[i] + even[N/2] - even[i];
	return ans;
}

long long ans_odd(int N, int A[])
{
	int i;
	long long odd[100001], dp[2], ans;
	for (i = 1, odd[0] = 0; i <= (N + 1) / 2; i++) odd[i] = odd[i-1] + A[i*2-1];
	ans = (odd[N/2] > odd[(N+1)/2] - A[1])? odd[N/2]: odd[(N+1)/2] - A[1];
	dp[0] = odd[1];
	dp[1] = A[2];
	if (dp[0] + odd[(N+1)/2] - odd[2] > ans) ans = dp[0] + odd[(N+1)/2] - odd[2];
	if (dp[1] + odd[(N+1)/2] - odd[2] > ans) ans = dp[1] + odd[(N+1)/2] - odd[2];
	for (i = 2; i <= N / 2; i++) {
		dp[1] = A[i*2] + ((dp[0] > dp[1])? dp[0]: dp[1]);
		dp[0] = odd[i];
		if (dp[0] + odd[(N+1)/2] - odd[i+1] > ans) ans = dp[0] + odd[(N+1)/2] - odd[i+1];
		if (dp[1] + odd[(N+1)/2] - odd[i+1] > ans) ans = dp[1] + odd[(N+1)/2] - odd[i+1];
	}
	return ans;
}

int main()
{
	int i, N, A[200001];
	scanf("%d", &N);
	for (i = 1; i <= N; i++) scanf("%d", &(A[i]));
	if (N % 2 == 0) printf("%lld\n", ans_even(N, A));
	else printf("%lld\n", ans_odd(N, A));
	fflush(stdout);
	return 0;
}