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 t=0 for u in range(5,-1,-1): t+=(1<=L: x=((1<=M: continue for j in range(N): if (i>>j)&1: continue for k in DP[i]: DP[i|(1<