n = int(input()) A = sorted(list(map(int,input().split()))) M = (n+2)*100 ans = 0 dp = [[0]*M for i in range(n+1)] dp[0][0] = 1 for ind,a in enumerate(A): for i in range(ind+1)[::-1]: for j in range(100*(ind+1))[::-1]: if dp[i][j] == 0: continue dp[i+1][j+a] += dp[i][j] if i and a*i <= j+a and (j+a)%i == 0: ans += dp[i][j] print(ans)