using System; using System.Collections.Generic; using System.Linq; class P { static int Search(int i) { int res = 0; if(i >= n) { res = 0; } else { res = Math.Max(Search(i + 2), Search(i + 3)) + V[i]; } return res; } static int n; static int[] V = new int[1000]; static void Main(string[]_) { n = int.Parse(Console.ReadLine()); V = new int[n + 1]; _=Console.ReadLine().Split(' '); for (int i = 0; i < n; i++) { V[i] = int.Parse(_[i]); } Console.WriteLine(Math.Max(Search(0),Search(1))); } }