import java.util.*; import java.lang.*; import java.io.*; class Ideone{ public static void main(String[] args) throws Exception{ // your code goes here BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int N = Integer.parseInt(br.readLine()); String[] prm = br.readLine().split(" "); ArrayList dish = new ArrayList(); for(String st:prm){ dish.add(Integer.parseInt(st)); } calc(0,0,dish); System.out.println(max); } private static int max = 0; private static HashMap map = new HashMap(); private static void calc(int ans,int idx,ArrayList dish){ if(map.containsKey(idx) && map.get(idx) > ans){ return; } map.put(idx,ans); if(idx >= dish.size()){ max = Math.max(ans,max); return; } calc(ans+dish.get(idx),idx+2,dish); calc(ans,idx+1,dish); return; } }