import core.stdc.stdio;
import std.algorithm;
 
void main(){
 int n;
 scanf("%d",&n);
 int[] nums = new int[n];
 for(int i=0;i<n;i++)
  scanf("%d",&nums[i]);
 long[] now = new long[21];
 long[] next = new long[21];
 now[0] = 1;
 foreach(i;nums[0..n-1]){
  next[] = 0;
  foreach(j,k;now){
   if(j+i<=20)
    next[j+i]+=k;
   if(j-i>=0)
    next[j-i]+=k;
  }
  swap(now,next);
 }
 printf("%d\n",now[nums[n-1]]);
}