#coding: UTF-8
import sys
import os
import fractions
from functools import reduce
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
n=int(input())
m=list(map(int,input().split()))
k=lcm_list(m)
k=k-1
answer=0
for i in range(n):
    answer=answer+(m[i]%k)
print(answer-n)