use num::integer::lcm;
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n: usize,
        a_list: [u128; n]
    }
    let mut m = 1;
    for &a in &a_list {
        m = lcm(m, a);
    }
    m = m - 1;
    println!("{}", a_list.iter().map(|x| m % x).sum::<u128>());
}
