import sys readline=sys.stdin.readline N=int(readline()) A=list(map(int,readline().split())) dp=[0]*(1<