N = gets.to_i

D = Array.new(N)

D = gets.split(" ").map(&:to_i)

dp = Array.new(N).map{Array.new(22, 0)}

dp[0][D[0]] = 1

for i in 1..(N - 2) do
    for j in 0..20 do
        if j + D[i] <= 20 then
            dp[i][j] += dp[i - 1][j + D[i]]
        end
        
        if j - D[i] >= 0 then
            dp[i][j] += dp[i - 1][j - D[i]]
        end
    end
end

puts "#{dp[N - 2][D[N - 1]]}"