//动态规划
#include<stdio.h>
#include<string.h>
int main()
{
int n,i;
int num[50],a[30];
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d",&a[i]);
memset(num,0,sizeof(num));
for(i=0;i<n;i++)
{
int k=40-a[i];
while(k>=0)
{
if(num[k]>0)
num[k+a[i]]+=num[k];
k--;
}
num[a[i]]++;
}
printf("%d\n",num[40]);
return 0;
}
//AC,自己写的
#include <iostream>
#include <cstdlib>
#include <cstring>
using namespace std;
int ch[25];
bool vis[25];
int ans,T;//Èç¹ûÈ«¾ÖÉùÃ÷Ϊcount£¬Ôò×ÜÌáʾundeclared£¬»»Á˾ͺÃÀ²£¬²»¶®£¡
void dfs(int cute,int j)
{
int i,k;
if(0==cute)
ans++;
else
{
for(i=j;i<T;i++)
if(!vis[i])
{
vis[i] = true;
dfs(cute-ch[i],i+1);
vis[i] = false;
}
}
}
int main()
{
int i,j,k;
cin>>T;
memset(ch,0,sizeof(ch));
memset(vis,false,sizeof(vis));
for(i=0;i<T;i++)
cin>>ch[i];
ans = 0;
dfs(40,0);
cout<<ans<<endl;
//system("pause");
return 0;
}