fn gcd(a: isize, b: isize) -> isize { if b == 0 { return a; } gcd(b, a%b) } fn lcm(a: isize, b: isize) -> isize { a / gcd(a, b) * b } fn main() { let mut nlh = String::new(); std::io::stdin().read_line(&mut nlh).ok(); let nlh: Vec = nlh.trim().split_whitespace().map(|s| s.parse().unwrap()).collect(); let n = nlh[0] as usize; let l = nlh[1]; let h = nlh[2]; let mut c = String::new(); std::io::stdin().read_line(&mut c).ok(); let c: Vec = c.trim().split_whitespace().map(|s| s.parse().unwrap()).collect(); let mut result = 0isize; for i in 1..1<> j) & 1) == 1).collect::>(); let used_cnt = targets.len() as isize; let mut lcmval = 1isize; let mut over = false; for &v in targets.iter() { lcmval = lcm(lcmval, c[v]); if lcmval > h { over = true; break; } } if over { continue; } if used_cnt % 2 == 1 { result += (h / lcmval - (l-1) / lcmval) * used_cnt; } else { result -= (h / lcmval - (l-1) / lcmval) * used_cnt; } } println!("{}", result); }