fn main() { let mut n = String::new(); std::io::stdin().read_line(&mut n).ok(); let n: usize = n.trim().parse().unwrap(); let mut a = String::new(); std::io::stdin().read_line(&mut a).ok(); let mut a: Vec = a.trim().split_whitespace().map(|s| s.parse().unwrap()).collect(); while !a.is_empty() && a[a.len()-1] == 0 { a.pop(); } if a.is_empty() { println!("Yes"); return; } let n = a.len(); let mut pop_cnt = 0usize; let mut idx = n-1; while !a.is_empty() { if (a[idx] + pop_cnt) % (idx+1) == 0 { let val = a.pop().unwrap(); pop_cnt += (val + pop_cnt) / (idx+1); } else { println!("No"); return; } if idx > 0 { idx -= 1; } } println!("Yes"); }