<?php
$n=trim(fgets(STDIN));
$a=explode(" ",trim(fgets(STDIN)));
$i=2;
$lcm=lcm($a[0],$a[1]);
while($i<$n){
	$lcm=lcm($lcm,$a[$i]);
    ++$i;
}
$ans=0;
foreach($a as $v){
  $ans+=($lcm-1)%$v;
}
echo $ans;


function gcd($x, $y) {
    if ($y == 0) {
        return $x;
    }
    return gcd($y,$x % $y);
}
function lcm($x,$y) {
  return $x / gcd($x,$y) * $y;
}