import java.util.*; public class Exercises20{ public static void main (String[] args){ Scanner sc = new Scanner(System.in); int numberOfSushi = sc.nextInt(); int[] sushiArray = new int[numberOfSushi]; for (int n = 0; n < numberOfSushi; n++){ sushiArray[n] = sc.nextInt(); } int[] dp = new int[2]; for (int n = 0; n < numberOfSushi; n++){ int[] dp2 = new int[2]; dp2[0] = Math.max(dp[0], dp[1]); dp2[1] = dp[0] + sushiArray[n]; dp = dp2; } System.out.println(Math.max(dp[0], dp[1])); } }