import java.util.Arrays; import java.util.LinkedList; import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); final int N = sc.nextInt(); int eated = 0, not_eated = 0, prev_eated = 0, prev_not_eated = 0; for(int i = 0; i < N; i++){ final int v = sc.nextInt(); eated = prev_not_eated + v; not_eated = Math.max(prev_eated, prev_not_eated); prev_eated = eated; prev_not_eated = not_eated; } System.out.println(Math.max(prev_eated, prev_not_eated)); } }