n=int(input()) a=list(map(int,input().split())) a.sort() ans=0 for i in range(1,n): mx=a[i] m=(mx+1)*i dp=[[0]*m for _ in range(i+1)] dp[0][0]=1 for j in range(i): for k in range(i-1,-1,-1): for l in range(m): if l+a[j]=mx: ans+=dp[j][k] print(ans)