import strutils, sequtils let N = stdin.readLine.parseInt V = stdin.readLine.split.map parseInt var dp = newSeq[int](N) try: dp[0] = V[0] dp[1] = max(V[0], V[1]) for i in 2 ..< N: dp[i] = max(dp[i - 1], dp[i - 2] + V[i]) except: discard echo dp.max