def dfs(i,n): global N global V global dp if i >= N:return 0 if dp[n][i] != -1:return dp[n][i] ret = 0 ret = max(ret,dfs(i + 2,n) + V[i]) ret = max(ret,dfs(i + 3,n) + V[i]) dp[n][i] = ret return dp[n][i] N = int(raw_input()) V = map(int,raw_input().split()) dp = [[-1 for j in range(N)] for i in range(2)] print max(dfs(0,0),dfs(1,1))