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

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