<?php
//error_reporting(0);
$N = trim(fgets(STDIN));
//list($n,$m,$d) = explode(" ",trim(fgets(STDIN)));
$a = explode(" ",trim(fgets(STDIN)));
$b = $a;
$lcm = calcLCM($b)-1;
$res = 0;
foreach($a as $k=>$v) {
  $res += $lcm % $v;
}
printf("%d\n",$res);

function calcGCD(array &$list) {
                        $c = count($list);

                        // ユークリッドの互除法を末尾2要素にかける
                        $v = $list[$c - 1] % $list[$c - 2];
                        if ($v === 0) {
                                if ($c === 2)
                                        return $list[$c - 2];

                                // 2要素の最大公約数が決まったら、配列を更新して再帰
                                array_pop($list);
                                return calcGCD($list);
                        }

                        $list[$c - 1] = $list[$c - 2];
                        $list[$c - 2] = $v;
                        return calcGCD($list);
                }
function calcLCM(array &$list) {
                        $c = count($list);
                        $v = $list[$c - 1] * $list[$c - 2] / gcd(array($list[$c - 1], $list[$c - 2]));

                        if ($c === 2)
                                return $v;

                        $list[$c - 2] = $v;
                        array_pop($list);
                        return calcLCM($list);
}
function gcd(array $list) {
                        // validationだけ先に
                        $c = count($list);
                        if ($c === 0)
                                return 0;
                        else if ($c === 1)
                                return $list[0];

                        return calcGCD($list);
                }
