fn get_factors(n: usize) -> Vec> { let mut ret = vec![vec![]; n+1]; for i in 1..=n { for j in 1..=n/i { ret[i*j].push(i); } } ret } fn main() { let mut nm = String::new(); std::io::stdin().read_line(&mut nm).ok(); let nm: Vec = nm.trim().split_whitespace().map(|s| s.parse().unwrap()).collect(); let n = nm[0]; let m = nm[1]; let mut a = String::new(); std::io::stdin().read_line(&mut a).ok(); let a: Vec = a.trim().split_whitespace().map(|s| s.parse().unwrap()).collect(); let mut opened = vec![false; n+1]; for &v in a.iter() { opened[v] = true; } let mut result = 0usize; let mut actual = vec![false; n+1]; let factors = get_factors(n); for i in (1..=n).rev() { if actual[i] == opened[i] { result += 1; continue; } for &v in factors[i].iter() { actual[v] = !actual[v]; } } println!("{}", result); }