use std::io::*; use std::str::FromStr; use utils::*; pub fn main() { let i = stdin(); let mut o = Vec::new(); run(i.lock(), &mut o); stdout().write_all(&o).unwrap(); } fn run(i: R, o: &mut W) { let mut i = CpReader::new(i); let n = i.read::(); let w = i.read_vec::(n); let r = if solve(&w) { "possible" } else { "impossible" }; writeln!(o, "{}", r).unwrap(); } fn solve(w: &[usize]) -> bool { let sum: usize = w.iter().sum(); if sum % 2 == 1 { return false; } fn get_result(w: &[usize], l: usize) -> bool { for i in 0..w.len() { let wi = w[i]; if wi == l || (wi < l && get_result(&w[i + 1..], l - wi)) { return true; } } false } get_result(w, sum / 2) } mod utils { use super::*; pub struct CpReader { r: R, s: String, } impl CpReader { pub fn new(r: R) -> Self { CpReader { r: r, s: String::new(), } } pub fn read_line(&mut self) -> &str { self.s.clear(); self.r.read_line(&mut self.s).unwrap(); self.s.trim() } pub fn read(&mut self) -> T { self.read_line().parse().ok().unwrap() } pub fn read_vec(&mut self, n: usize) -> Vec { self.read_line() .split(' ') .take(n) .map(|x| x.parse().ok().unwrap()) .collect() } } }