import Foundation let n = Int(readLine()!)! let weights = readLine()!.split(separator:" ").map { Int($0)! } var weightSum = 0 var maxWeight = 0 weights.forEach { weight in weightSum += weight maxWeight = Swift.max(weight, maxWeight) } if weightSum % 2 != 0 { print("impossible") exit(0) } let goal = weightSum / 2 if maxWeight > goal { print("impossible") exit(0) } var possibilities = Array(repeating: -1, count: goal + 1) weights.enumerated().forEach { i, weight in if possibilities[weight] < 0 { possibilities[weight] = i } for j in 1 ..< Swift.min(goal - weight + 1, possibilities.count) { if possibilities[j] < 0 { continue } if possibilities[j] >= i { continue } if possibilities[j + weight] >= 0 { continue } if j + weight == goal { print("possible") exit(0) } possibilities[j + weight] = i } } print("impossible") exit(0)