import numpy as np
N=int(input())
a=np.array(list(map(int,input().split())))

def f(m):
    ret=0
    for i in a:
        ret+=m%i
    return ret
  
def gcd_(a,b):
    if a<b:    a,b=b,a
    if b==0:    return a
    return gcd_(b,a%b)

def lcm_(x,y):
    return (x*y)//gcd_(x,y)

def lcm(l):
    ans=l[0]
    for i in l:
        ans=lcm_(ans,i)
    return ans
  
print(f(lcm(a)-1))