import sys input = sys.stdin.readline N=int(input()) A=list(map(int,input().split())) # x個なら、和が(x-1)の倍数k*(x-1)で、各数字がk以下 A.sort() SUM=sum(A) DP=[[0]*(SUM+1) for i in range(N+1)] DP[0][0]=1 ANS=0 for a in A: for i in range(N-1,-1,-1): for j in range(SUM-a,-1,-1): if DP[i][j]==0: continue else: if i>=1 and (j+a)%i==0: k=(j+a)//i if a<=k: ANS+=DP[i][j] DP[i+1][j+a]+=DP[i][j] print(ANS)