import sys #input = sys.stdin.readline #文字列につけてはダメ #input = sys.stdin.buffer.readline #文字列につけてはダメ #sys.setrecursionlimit(1000000) #import bisect #import itertools #import random #from heapq import heapify, heappop, heappush #from collections import defaultdict #from collections import deque #import copy #import math #from functools import lru_cache #@lru_cache(maxsize=None) #MOD = pow(10,9) + 7 #MOD = 998244353 #dx = [1,0,-1,0] #dy = [0,1,0,-1] def main(): N = int(input()) A = list(map(int,input().split())) A.sort() ans = 0 for a in range(1,N): #total = pow(2,a) #自分以外を選ぶ場合の数 #dp[i][j][k]:i番目まで見てj個選んで和がkとなる場合の数 MAX = 105*a dp = [[0]*MAX for _ in range(a+1)] dp[0][0] = 1 for i in range(a): p = [[0]*MAX for _ in range(a+1)] p,dp = dp,p for j in range(a+1): for k in range(MAX): if j+1 < a+1 and k+A[i] < MAX: dp[j+1][k+A[i]] += p[j][k] dp[j][k] += p[j][k] #print(dp) temp = 0 for j in range(1,a+1): #1個の時はダメなので1から for k in range(MAX): if (k + A[a]) % j != 0: continue x = (k + A[a]) // j if x >= A[a]: temp += dp[j][k] #print("temp",temp) ans += temp print(ans) if __name__ == '__main__': main()