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];
 foreach(i;nums[0..n-1]){
  next[] = 0;
  foreach(j;now){
   if(j+i<=20)
    next[j+i]++;
   if(i-j>=0)
    next[i-j]++;
  }
  swap(now,next);
 }
 printf("%d\n",now[nums[n-1]]);
}