MOD = 998244353
def add(a, b)
  return (a.to_i + b.to_i) % MOD
end

def sub(a, b)
  return (a.to_i - b.to_i) % MOD
end

n = gets.chomp.to_i
sum = 0
a = []

n.times do |i|
  a[i] = gets.chomp.to_i
  sum += a[i]
end
a.sort!

dp = Array.new(n){ Hash.new() }
dp_eq = Array.new(n){ Hash.new() }
ans = (3 ** n) % MOD

n.times do |i|
  if i == 0
    dp[0][0] = 2
    dp[0][a[0]] = 1
    dp_eq[0][0] = 1
    dp_eq[0][a[0]] = 1
    next
  end

  dp[i-1].each do |k, v|
    dp[i][k] = add(dp[i][k], 2*v)
    dp[i][k+a[i]] = add(dp[i][k+a[i]], v)
  end

  dp_eq[i-1].each do |k, v|
    dp_eq[i][k] = add(dp_eq[i][k], v)
    dp_eq[i][k+a[i]] = add(dp_eq[i][k+a[i]], v)
  end

end

dp[n-1].each do |k, v|
  ans = sub(ans, 3*v) if 2*k >= sum
end

ans = add(ans, 3*dp_eq[n-1][sum/2].to_i) if sum%2 == 0

puts ans
