use std::collections::*; fn main() { let _ = read_vec::(); let a = read_vec::().into_iter().collect::>(); let mut flag = vec![false; 30]; for i in 0..20 { if a.contains(&i) { flag[i as usize] = true; } } loop { let mut changed = false; for i in 0..20 { if flag[i] { continue; } if flag[i + 3] && flag[i + 4] { flag[i] = true; changed = true; } else if flag[i + 2] && flag[i + 5] { flag[i] = true; changed = true; } else if flag[i + 1] && flag[i + 6] { flag[i] = true; changed = true; } } if !changed { break; } } if flag[1] { println!("No"); return; } for &anum in &a { if anum < 10 { continue; } if a.contains(&(anum + 1)) || a.contains(&(anum + 3)) || a.contains(&(anum + 5)) { println!("No"); return; } } println!("Yes"); } fn read() -> T { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); s.trim().parse().ok().unwrap() } fn read_vec() -> Vec { read::() .split_whitespace() .map(|e| e.parse().ok().unwrap()) .collect() }