const LIMIT: usize = 200000; 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 a: Vec = a.trim().split_whitespace().map(|s| s.parse().unwrap()).collect(); let mut acnts = vec![0usize; LIMIT+1]; for &v in a.iter() { acnts[v] += 1; } for i in (0..LIMIT).rev() { acnts[i] += acnts[i+1]; } let mut divides = vec![0usize; LIMIT+1]; for i in 1..=LIMIT { for j in 1..=LIMIT/i { divides[i] += i*acnts[i*j] } } let mut result = a.iter().sum::() * n; for &v in a.iter() { result -= divides[v]; } println!("{}", result); }