N = int(input()) A = [int(i) for i in input().split()] DP = [0]*(1<