n = gets.to_i
m = gets.split(" ").map(&:to_i)
numbers = m[0,n-1]
answer = m[-1]
dp = Array.new(n-1) {Array.new(21, 0)}
dp[0][numbers[0]] = 1
numbers[1..-1].each_with_index do |number, i|
  #p i
  dp[i].each_with_index do |current, j|
    if ! ((j + number) > 20)
      dp[i+1][j + number] += current
    end
    if ! ((j - number) < 0)
      dp[i+1][j - number] += current
    end
  end
end
puts dp[-1][answer]