N=int(input()) C=list(map(int,input().split())) A=[] for i in range(9): for j in range(C[i]): A.append(i+1) ANS=0 M=(N+1)>>1 L=N>>1 for t in range(1,60): mod=1<=L: x=((1<=M: continue for j in range(N): if (i>>j)&1: continue for k in DP[i]: DP[i|(1<