## constant

MAX_SUM = 20

### main

n = gets.strip.to_i
ds = gets.strip.split(' ').map{|s| s.to_i}

n -= 1
sum = ds.pop
#p [ds, sum]

psums = (MAX_SUM + 1).times.map{0}
psums[ds[0]] = 1

for i in (1...n)
  d = ds[i]
  csums = (MAX_SUM + 1).times.map{0}

  for s in (0..MAX_SUM)
    s0 = s + d
    csums[s0] += psums[s] if s0 <= MAX_SUM
    s1 = s - d
    csums[s1] += psums[s] if s1 >= 0
  end

  psums = csums
  #p [d, psums]
end

puts psums[sum]