import java.util.*; import java.lang.*; import java.io.*; class sushi { private static final int MAX_N = 1000; static int n; // sushiの数 static int v[] = new int[MAX_N]; //sushiの価値 public static void main(String[] args) { Scanner sc = new Scanner(System.in); n = sc.nextInt(); for (int i = 0; i < n; i++) { v[i] = sc.nextInt(); } sc.close(); System.out.println(eat(0, -2)); } static int eat(int i,int j) { int ret; // 皿がない場合 if (i == n) { ret = 0; // 食べたらダメな皿の場合 } else if (i == j + 1) { ret = eat(i+1, j); } else { // 食べた場合と食べなかった場合を比べる if (i == n -1) { ret = eat(i+1, i) + v[i]; } else { int tmp1 = eat(i+1, i) + v[i]; int tmp2 = eat(i+1, j); ret = (tmp1 < tmp2) ? tmp2:tmp1; //ret = Math.max(eat(i+1, i) + v[i], eat(i+1, j)); } } return ret; } }