from collections import * inf=10**16 n = int(input()) A = list(map(int,input().split())) dp=[-inf]*(1<