import std.algorithm,
       std.string,
       std.range,
       std.stdio,
       std.conv;

void main() {
  int   N  = readln.chomp.to!(int);
  int[] ns = readln.chomp.split.to!(int[]);
  int   x  = ns[$-1];
  ulong[21][101] dp;

  dp[0][ns[0]]++;

  foreach (i; 1..(N-1)) {
    foreach (j; 21.iota) {
      int a = j + ns[i];
      int b = j - ns[i];

      if (0 <= a && a <= 20) {
        dp[i][a] += dp[i - 1][j];
      }
      if (0 <= b && b <= 20) {
        dp[i][b] += dp[i - 1][j];
      }
    }
  }

  writeln(dp[N-2][x]);
}