#include using namespace std; using ll = long long; int main () { int N; cin >> N; ll A[55][5004]; int X[55]; for (int i = 0; i < N; i ++) { cin >> X[i]; } sort(X, X + N); for (int i = 0; i <= N; i ++) { for (int j = 0; j <= 5000; j ++) { A[i][j] = 0; } } A[0][0] = 1; ll ans = 0; for (int i = 0; i < N; i ++) { for (int j = 1; j <= i; j ++) { for (int k = 0; k <= 5000; k += j) { if (k < X[i] || ((k - X[i]) / j < X[i])) { continue; } ans += A[j][k - X[i]]; } } for (int j = i; j > 0; j --) { for (int k = X[i]; k <= 5000; k ++) { A[j][k] += A[j - 1][k - X[i]]; } } } cout << ans << endl; }