<?php
$n = trim(fgets(STDIN));
$a = explode(' ', trim(fgets(STDIN)));
for ($i = 0; $i < $n; $i++) {
    $a[$i] = (int)$a[$i];
}

$lcm = 1;
for ($i = 0; $i < $n; $i++) {
    $lcm = lcm($lcm, $a[$i]);
}

$ans = 0;
for ($i = 0; $i < $n; $i++) {
    $ans += ($lcm - 1) % $a[$i];
}

echo $ans . PHP_EOL;

function gcd($m, $n){
    if($n > $m) list($m, $n) = array($n, $m);

    while($n !== 0){
        $tmp_n = $n;
        $n = $m % $n;
        $m = $tmp_n;
    }
    return $m;
}

function lcm($m, $n){
    return $m * $n / gcd($m, $n);
}