const SIZE: 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 summary = a.iter().sum::(); let mut result = summary * n; let mut cnts = vec![0usize; SIZE+1]; for &v in a.iter() { cnts[v] += 1; } for i in (0..SIZE).rev() { cnts[i] += cnts[i+1]; } let mut divides = vec![0usize; SIZE+1]; for i in 1..=SIZE { for j in 1..=SIZE/i { divides[i] += cnts[i*j]; } } for i in 0..n { result -= a[i] * divides[a[i]]; } println!("{}", result); }