n = int(input()) a_list = list(map(int, input().split())) dp = [0] * (1<