#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
#define maxn 21
int A[maxn];
int ff(int num,int i)
{
if(num==0)
return 1;
if(i==0)
return 0;
return ff(num-A[i],i-1)+ff(num,i-1);
}
int main()
{
int n;
while(cin>>n)
{
for(int i=1;i<=n;i++)
{
cin>>A[i];
}
cout<<ff(40,n)<<endl;
}
return 0;
}