n=int(input()) v=[int(i) for i in input().split()] if v[0]>v[1]:v[1]=v[0] for i in range(2,n): v[i]=(v[i]+v[i-2] if v[i-1]