use std::io::Read; fn factor(a: u32) -> Vec { let mut a = a; let mut k = 2; let mut b = vec![]; while k * k <= a { if a % k == 0 { b.push(k); } while a % k == 0 { a /= k; } k += 1; } if a > 1 { b.push(a); } b } fn run() { let mut s = String::new(); std::io::stdin().read_to_string(&mut s).unwrap(); let mut it = s.trim().split_whitespace(); let n: usize = it.next().unwrap().parse().unwrap(); let a: Vec = (0..n).map(|_| it.next().unwrap().parse().unwrap()).collect(); let mut memo = std::collections::BTreeSet::new(); let mut ans = (1i64 << (n as i64)) - 1; for &v in &a { let f = factor(v); let len = f.len(); for i in 1..(1 << len) { let mut p = 1; let mut sign = 1; for (j, &f) in f.iter().enumerate() { if (i >> j) & 1 == 1 { p *= f; sign *= -1; } } if memo.contains(&p) { continue; } memo.insert(p); let mut cnt = 0; for &a in &a { if a % p == 0 { cnt += 1; } } ans += sign * ((1 << cnt) - 1); } } println!("{}", ans); } fn main() { run(); }