#include <iostream>
#include <string>
#include <math.h>
#include<algorithm>
#include<cstdio>
#include<string.h>
using namespace std;
int n;
int a[50];
int dp[40][30];
int main()
{
cin >> n;
memset(dp, 0, sizeof(dp));
for (int i = 1; i <= n; i++)
{
cin >> a[i];
dp[0][i] = 1;
}
dp[0][0] = 1;
for (int i = 1; i <= 40; i++)
{
for (int j = 1; j <= n; j++)
{
dp[i][j] = dp[i][j - 1];
if (i - a[j] >= 0)
{
dp[i][j] += dp[i - a[j]][j - 1];
}
}
}
cout << dp[40][n];
}