@solve = Hash.new
def solve(i, n)
  @solve[i + n * 100] ||= (
    if n < 0 or n > 20
      0
    elsif i == Last
      n == Eq ? 1 : 0
    else
      solve(i + 1, n + Nums[i]) + solve(i + 1, n - Nums[i])
    end
  )
end

N = gets.to_i
Last = N - 1
Nums = gets.split.map(&:to_i)
Eq = Nums.pop

p solve(0, 0)