use std::{collections::HashMap, io::stdin}; fn main() { let stdin = stdin(); let mut stdin = stdin.lines().map(Result::unwrap); let _n = stdin.next().unwrap().parse::().unwrap(); let a = stdin .next() .unwrap() .split_whitespace() .map(|x| x.parse::().unwrap()) .collect::>(); let mut dp = HashMap::new(); dp.insert(0, 1_u64); for &x in &a { let mut swp = dp.clone(); for (k, v) in dp { *swp.entry(gcd(k, x)).or_insert(0) += v; } dp = swp; } let ans = dp.get(&1).copied().unwrap_or(0); println!("{}", ans); } fn gcd(mut m: u64, mut n: u64) -> u64 { if m == 0 || n == 0 { return m | n; } let shift = (m | n).trailing_zeros(); m >>= m.trailing_zeros(); n >>= n.trailing_zeros(); while m != n { if m > n { m -= n; m >>= m.trailing_zeros(); } else { n -= m; n >>= n.trailing_zeros(); } } m << shift }