n = gets.to_i w = gets.split.map(&:to_i) total = w.sum if total % 2 == 1 puts "impossible" exit 0 end dp = [false] * (total / 2 + 1) dp[0] = true w.each do |wi| # p wi # dp[wi] = true (0..(dp.size)).to_a.reverse.each do |num| # p "#{wi}, #{num}" # p dp dp[wi+num] = true if dp[wi] end end # p dp, w puts dp[total/2] ? "possible" : "impossible"