Problem:
 Score : 300 points    Problem Statement You are given N positive integers a_1, a_2, ..., a_N .  For a non-negative integer m , let f(m) = (m\ mod\ a_1) + (m\ mod\ a_2) + ... + (m\ mod\ a_N) .  Here, X\ mod\ Y denotes the remainder of the division of X by Y .  Find the maximum value of f .      Constraints  All values in input are integers.  2 \leq N \leq 3000  2 \leq a_i \leq 10^5         Input Input is given from Standard Input in the following format:  N  a_1  a_2  ...  a_N       Output Print the maximum value of f .        Sample Input 1 3
3 4 6      Sample Output 1 10  f(11) = (11\ mod\ 3) + (11\ mod\ 4) + (11\ mod\ 6) = 10 is the maximum value of f .       Sample Input 2 5
7 46 11 20 11      Sample Output 2 90       Sample Input 3 7
994 518 941 851 647 2 581      Sample Output 3 4527

Solution (Python):
N = int(input())
A = list(map(int, input().split()))

f = 0
for a in A:
    f += a-1
print(f)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))

print(sum(a) - n)

Solution (Python):
from functools import reduce
import math

n = int(input())
a_list = [int(a) for a in input().split()]
maxv = sum([a-1 for a in a_list])
print(maxv)

Solution (Python):
NUM_MAX = 10**5
is_prime = [True] * NUM_MAX
is_prime[0] = False
is_prime[1] = False
primes = []
for i in range(2, NUM_MAX):
    if is_prime[i]:
        primes.append(i)
        for j in range(2*i, NUM_MAX, i):
            is_prime[j] = False

def solve(n, a):
    def f(m):
        return sum([m % p for p in a])
    D = {}
    for v in a:
        d = {}
        for prime in primes:
            while v % prime == 0:
                v /= prime
                if not prime in d:
                    d[prime] = 0
                d[prime] += 1
        for prime, num in d.items():
            if not prime in D:
                D[prime] = 0
            D[prime] = max(D[prime], num)
    m = 1
    for prime, num in D.items():
        for i in range(num):
            m *= prime
    return f(m-1)

assert solve(3, [3,4,6]) == 10
assert solve(5, [7,46,11,20,11]) == 90
assert solve(7, [994,518,941,851,647,2,581]) == 4527

n = input()
a = map(int, raw_input().split())
print solve(n, a)

Solution (Python):
n=int(input())
a=list(map(int, input().split()))
m=1
ans=0
for i in range(n):
  m *= a[i]
  ans +=(m-1)%a[i] 
print(ans)

Solution (Python):
N = int(input())
L = [int(i) - 1 for i in input().split()]
print(sum(L))

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
print(sum(a)-n)

Solution (Python):
n=int(input())
print(sum(list(map(int,input().split())))-n)

Solution (Python):
N = int(input())
nums = list(map(int, input().split()))
ans = 0
for i in nums:
    ans += i-1
print(ans)

Solution (Python):
n=int(input())
s=input().split()
a=[None]*n
for i in range(n):
    a[i]=int(s[i])-1
print(sum(a))

Solution (Python):
import numpy as np
N = int(input())
a = list(map(int,input().split()))
print (np.sum(a)-len(a))

Solution (Python):
n=int(input())
a=list(map(int, input().split()))
ans=sum(a)-n
print(ans)

Solution (Python):
def c_modulo_summation(N, A):
    return sum(a-1 for a in A)

N = int(input())
A = [int(i) for i in input().split()]
print(c_modulo_summation(N, A))

Solution (Python):
input()
a=list(map(int,input().split(' ')))
sum=0
for i in a:
    sum+=i-1
print(sum)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))

ans=sum(a) - n
print(ans)

Solution (Python):
n = int(input())
array = [int(x) for x in input().split()]

res = 0
for i in array:
    res += i-1
print(res)

Solution (Python):
if __name__ == '__main__':
    n = int(input())
    a = list(map(int, input().split()))
    print(sum(a) - n)

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
ans = 0
for x in a:
	ans += x - 1
print(ans)

Solution (Python):
n=int(input())
s=list(map(int,input().split()))
print(sum(s)-n)

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
res = 0;
for i in range(N):
    res += a[i]-1
    
print (res)

Solution (Python):
n=int(input())
a=map(int,input().split())
print(sum(a)-n)

Solution (Python):
input()
print(sum(list(map(lambda x: int(x)-1, input().split()))))

Solution (Python):
input()
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
def lcm(a, b):
	return a * b // gcd (a, b)
li  = list(map(int,input().split(" ")))
s  = lcm(li[0],li[1])
for i in range(len(li)-2):
    s = lcm (s,li[i+2])
def f(m):
    r = 0
    for i  in li:
        r += m%i
    return r
print(f(s-1))

Solution (Python):
N = int(input())
a = [int(i) for i in input().split()]

ans = sum(a) - N
print(ans)

Solution (Python):
N=int(input())
a=list(map(int,input().split()))
print(sum(a)-N)

Solution (Python):
n = int(input())
a=list(map(int, input().split()))
print(sum(a) - len(a))

Solution (Python):
import sys
import functools

def na(): return map(int,sys.stdin.readline().split())
def ns(): return sys.stdin.readline().strip()


n,=na()
a=list(na())

print(functools.reduce(lambda x,y: x+y-1,a)-1)

Solution (Python):
n = int(input())
print(sum(list(map(int, input().split()))) - n)

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
ans = 0
for i in range(n):
  ans += a[i]-1
print(ans)

Solution (Python):
N = int(input())
A = list(map(int,input().split()))

ans = 0
for i in range(N):
    ans += A[i] - 1

print(ans)

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(n):
	ans+=(a[i]-1)
print(ans)

Solution (Python):
N = int(input())
L = [int(i) for i in input().split()]
print(sum(L) - N)

Solution (Python):
N = int(input())
A = list(map(int, input().split()))

A1 = [a - 1 for a in A]

print(sum(A1))

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
print(sum(a)-n)

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
def gcd(b,c):
    while c!=0:
        b,c=c,b%c
    return b
def lcm(b,c):
    return b*c//gcd(b,c)
temp=a[0]
for i in range(n):
    temp=lcm(a[i],temp)
ans=temp-1
total=0
for i in range(n):
    total+=ans%a[i]
print(total)

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
print(sum(a) - N)

Solution (Python):
from sys import stdin
from fractions import gcd

N =  [int(i) for i in input().split()]
nums =[int(i) for i in input().split()]
print(sum(nums)-N[0])

Solution (Python):


N = int(input())
aN = list(map(int, input().split()))

print(sum(aN)-N)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))

a_sum = 0
for i in range(n):
    a_sum += a[i]

print(a_sum - n)

Solution (Python):

import fractions

n = int(input().strip())
an = list(map(int, input().strip().split(' ')))


def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)


temp = an[0]
for i in range(len(an)):
    temp = lcm(temp, an[i])

m = temp - 1

ret = 0
for a in an:
    ret += m % a

print(ret)

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
print(sum(a)-n)

Solution (Python):
N = int(input())
t = [int(i) for i in input().split()]
print(sum(t)-N)

Solution (Python):
print(-int(input())+sum(map(int,input().split())))

Solution (Python):
N = int(input())
*A, = map(int, input().split())
print(sum(A)-N)

Solution (Python):
N = int(input())
print(sum(list(map(int, input().split(" "))))-N)

Solution (Python):
n = int(input())
a = [int(i) for i in input().split()]
ans = 0
for i in range(n):
    ans += a[i]-1
print(ans)

Solution (Python):
print(-int(input())+sum(list(map(int,input().split()))))

Solution (Python):
n = int(input())

num = list(int(i) for i in input().split())

f = sum(num)-n
print(f)

Solution (Python):
n=int(input())
print(sum(list(map(int,input().split())))-n)

Solution (Python):
def main():
    N = int(input())
    strs = input()
    As = sorted([int(num) for num in strs.split()], reverse=True)
    print(sum([a - 1 for a in As]))


if __name__ == '__main__':
    main()

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
print(sum(a)-n)

Solution (Python):


import sys
import math
import itertools as it
from collections import deque

sys.setrecursionlimit(10000000)

_ = input()
A = map(int, raw_input().split())
sz = len(A)

print sum(A) - sz

Solution (Python):
print(-int(input())+sum(map(int,input().split())))

Solution (Python):














N = map(int, input())
a_n = list(map(int, input().split(" ")))


max = 0
for x in a_n:
  max += x
 


  
  



print(max - len(a_n))

Solution (Python):
print(-int(input())+sum(map(int,input().split())))

Solution (Python):
N = int(input())
a = [int(i) for i in input().split()]
print(sum(a)-N)

Solution (Python):
N = int(input())
A = [int(_) for _ in input().split()]
print(sum(A) - N)

Solution (Python):
N = input()
a = list(map(int, input().split()))

summ2 = sum(a) - int(N)

print(summ2)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))

print(sum(a) - len(a))

Solution (Python):
print(-int(input())+sum(map(int,input().split())))

Solution (Python):
import math

n = input()
a = input().split()
N = int(n)

ans_list = []
ann = []
ana = 1
for j in range(N):
    ana = ana * int(a[j])
ana = ana -1
ans = 0
for k in range(N):
    ans += int(ana % int(a[k]))
ans_list.append(ans)

ans_list.sort()
ans_list.reverse()
print(str(ans_list[0]))

Solution (Python):
n = int(input())
a = [int(m) for m in input().split(" ")]

print(sum(a)-len(a))

Solution (Python):
N=input();print(sum(map(int,input().split()))-int(N))

Solution (Python):
N=input();print(sum(list(map(int,input().split())))-int(N))

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
print(sum(a) - N)

Solution (Python):
from sys import stdin                                                                                                                                                                                       
N = int(stdin.readline().rstrip())                                                                                                                                                                          
a = [int(x) for x in stdin.readline().rstrip().split()]                                                                                                                                                     
ans = 0                                                                                                                                                                                                     
for x in a:                                                                                                                                                                                                 
    ans += x -1                                                                                                                                                                                             
print(ans)

Solution (Python):
n = int(input())
a = list(int(i) for i in input().split())

print(sum(a)-n)

Solution (Python):
n = int(input())
a = [int(i) for i in input().split()]
print(sum(a) - n)

Solution (Python):


import sys
import re
import math
import itertools
import collections
import bisect



mod=1000000007

pi=3.1415926535897932
IS=float('inf')
xy=[(1,0),(-1,0),(0,1),(0,-1)]
bs=[(-1,-1),(-1,1),(1,1),(1,-1)]
def niten(a,b): return abs(a-b) if a>=0 and b>=0 else  a+abs(b) if a>=0 else abs(a)+b if b>=0 else abs(abs(a)-abs(b))
def fib(n): return [(seq.append(seq[i-2] + seq[i-1]), seq[i-2])[1] for seq in [[0, 1]] for i in range(2, n)]
def gcd(a,b): return a if b==0 else gcd(b,a%b)
def lcm(a,b): return a*b//gcd(a,b)
def eucl(x1,y1,x2,y2): return ((x1-x2)**2+(y1-y2)**2)**0.5
def choco(xa,ya,xb,yb,xc,yc,xd,yd): return 1 if abs((yb-ya)*(yd-yc)+(xb-xa)*(xd-xc))<1.e-10 else 0








def prime_t(t):
    i=2
    while i**2<=t:
        if t%i==0:
            return 0
        i+=1
    return 1


n=int(input())
a=[int(i) for i in input().split()]
tmp=a[0]
ans=chk=0
for i in range(1,n):
    tmp=lcm(tmp,a[i])
if n%2!=0: tmp=lcm(tmp,a[-1])
y=tmp-1
p=0
for i in a:
   p+=y%i
print(p)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
for i in range(n):
    a[i] -= 1
print(sum(a))

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
print(sum(a)-n)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))

print(sum(a) - n)

Solution (Python):
import sys
sys.setrecursionlimit(30000)

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

def lcm(a, b):
    return (a * b) // gcd(a, b)

def lcm_list(li):
    if len(li) == 2:
        return lcm(li[0], li[1])

    else:
        li = [lcm(li[0], li[1])] + li[2:]
        return lcm_list(li)

N = int(input())
a = list(map(int, input().split()))


i = max(lcm_list(a) - 1, 1)
print(sum([i % j for j in a]))

Solution (Python):
N = int(input())

a = list(map(int,input().split()))

sum =0
for i in a:
    sum+=i-1
print(sum)

Solution (Python):
N = int(input())
A = [int(i) for i in input().split()]
Answer = 0
while N > 0:
  Answer += A[N-1]-1
  N -= 1
print(Answer)

Solution (Python):
print((lambda a,b:sum(b)-int(a))(input(),list(map(int,input().split()))))

Solution (Python):
print(-int(input())+sum(map(int,input().split())))

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
sum = 0
for a_i in a:
    sum += a_i-1
print(sum)

Solution (Python):
import fractions
from functools import reduce

def lcm(a,b):
    return a*b // fractions.gcd(a,b)

n = input()
a = [int(_) for _ in input().split()]


m = reduce(lcm, a) - 1

f = 0
for ai in a:
    f = f + m%ai

print(f)

Solution (Python):
from functools import reduce
def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = a % b
    return gcd(b, c)


def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm(nums):
    return reduce(lcm_base, nums, 1)

n, a = input(), list(map(int, input().split()))
l = lcm(a)
sum = 0
for aa in a:
    sum += (l-1) % aa
print(sum)

Solution (Python):
n = int(input())
a = [int(i) for i in input().split()]
print(sum(a)-n)

Solution (Python):
n = int(input())
A = list(map(int, input().split()))
print(sum(A) - n)

Solution (Python):
N = int(input())
Nlist = list(map(int, input().split()))
ans = 0
for x in Nlist:
    ans += x-1
print(ans)

Solution (Python):
N=int(input())
A=[int(i) for i in input().split()]
print(sum(A)-N)

Solution (Python):


from functools import reduce

def gcd(a, b):
    while b:
      a, b = b, a % b
    return a

def lcm_base(x, y):
    return (x * y) // gcd(x, y)

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

N = input()
a_list = map(int, input().split())
a_list = list(a_list)

m = lcm(a_list) - 1
fm = 0

for i in a_list:
    fm = fm+(m % i)

print(fm)

Solution (Python):


 
def main():
	N = int(input())
	a = list(map(int, input().split()))
	SUM = 0
	for i in a:
		SUM += i
	print(SUM - N)


if __name__ == '__main__':
	main()

Solution (Python):


n = int(raw_input())

l = map(int, raw_input().split())

ret= sum([(a-1) for a in l])
print ret

Solution (Python):
def gcd(a,b):
	if a==0:
		return b
	return gcd(b%a,a)

def find_lcm(num1, num2):
    if(num1>num2):
        b = num1
        a = num2
    else:
        b = num2
        a = num1
    G = gcd(a,b)
    lcm = (num1*num2)//G
    return lcm
     
N=int(input())
A=list(map(int,input().split()))
lcm = find_lcm(A[0],A[1])
for I in range(2, N):
    lcm = find_lcm(lcm, A[I])
Ans=0
lcm-=1
for I in range(N):
	Ans+=(lcm%A[I])
print(Ans)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
print(sum(a) - len(a))

Solution (Python):
N = input()
list = list(map(int,input().split()))
ans = 0
for i in list:
 ans += i - 1
print(ans)

Solution (Python):
def spaceinput():
    return list(map(int,input().split(" ")))


N=int(input())
a=spaceinput()
print(sum(a)-N)

Solution (Python):
import fractions


def run(n, a):
    '''
    g = a[0]
    for j in range(1, len(a)):
        g = int(g * a[j] / fractions.gcd(g, a[j]))
    m = g
    tmp_f = 0
    f = 0
    for i in range(1, m+1):
        tmp_f = 0
        for j in range(len(a)):
            tmp_f += i % a[j]
        f = max(f, tmp_f)
    '''
    f = 0
    for i in range(len(a)):
        f += a[i] - 1
    return f


def read_line():
    n = int(input())
    a = list(map(int, input().split()))
    return (n, a)


def main():
    n, a = read_line()
    print(run(n, a))


if __name__ == '__main__':
    main()

Solution (Python):


def main():
    n = input()
    arr = input()
    nums = [int(c) for c in arr.split(" ")]

    print(sum([(n - 1) for n in nums]))

if __name__ == "__main__":
    main()

Solution (Python):
n = int(input())
a = list(map(int,input().split()))






ans = 0
for i in range(n):
    ans += a[i] - 1

print(int(ans))

Solution (Python):

N = int(input())
a = input().split()
a = [int(i) for i in a]
res_list = {}
def gcd(a,b):
    while b:
        a, b = b, a % b
    return a
def lcm(x,y):
    return (x * y) // gcd(x, y)
for i in range(len(a)):
    if i == 0:
        res = a[i]
        continue
    else:
        res = lcm(res,a[i])
res2 = 0
for i in a:
    res2 += (res-1) % i
print(res2)

Solution (Python):
import fractions

def lcm(x,y):
    return (x*y) // fractions.gcd(x,y)

N = int(input())
a = list(map(int, input().split()))
L = a[0]
f = 0

for i in range(N-1):
    L = lcm(L,a[i+1])

for i in range(N):
    f = f + (L-1)%a[i]

print(f)

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
li = [0]
fmax = 0

for i in range(N):
  fmax += a[i]
print(fmax-N)

Solution (Python):
a = map(int, raw_input().split())
b = map(int, raw_input().split())

sum = 0
for i in range(len(b)):
  sum = sum + b[i]

ans = sum-len(b)
print ans

Solution (Python):
N = int(input())
a = list(map(int,input().split(" ")))
sum = 0

for i in range(len(a)):
  sum += a[i] - 1
  
print(sum)

Solution (Python):
import fractions

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

n = int(input())
inputs = list(map(int, input().split(' ')))
for i in range(len(inputs)):
    if i == 0:
        x = lcm(inputs[0], inputs[1])
        continue
    if i == 1:
        continue
    x = lcm(x, inputs[i])
x -= 1
s = 0
for i in inputs:
    s += x % i
print(s)

Solution (Python):
N=int(input())
s=list(map(int,input().split(' ')))
ans=0
for i in range(N):
    ans+=s[i]-1
print(ans)

Solution (Python):
input()
ip = input().split()
data = []
ans = 0
for i in ip:
    ans += int(i) - 1

print(ans)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(0,n):
    ans = ans + a[i]-1
print(ans)

Solution (Python):
import fractions
from functools import reduce
 
 
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)
 
 
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
 
 
n = int(input())
a = [int(i) for i in input().split()]
 
ans1 = 0
 
lcm = lcm_list(a)
 
for num in a:
    ans1 += (lcm - 1) % num
 
print(ans1)

Solution (Python):
N = int(input())
a = list(map(int,input().split(" ")))
print(sum(a) - N)

Solution (Python):
import numpy as np
n = int(input())
a = np.array(list(map(int,input().split())))-1
print(a.sum())

Solution (Python):
import numpy as np
N = int(raw_input())
a = map(int, raw_input().split())
print (np.sum(a) - N)

Solution (Python):
n = int(input())
a = [ int(x) for x in input().split(" ") ]

s = 0
for i in a:
    s += i - 1
print(s)

Solution (Python):
n=int(input())
a=[int(i) for i in input().split()]

print(sum(a)-len(a))

Solution (Python):
n = input()
a = list(map(int,input().split()))
ans = 0
for num in a:
	ans = ans + num -1
print(ans)

Solution (Python):
from functools import reduce
from operator import mul

def gcd(a, b):
    m, n = a, b
    while m % n != 0:
        m, n = n, m%n
    return n


def lcm(a, b):
    return (a * b) // gcd(a, b)


N = int(input())
A = map(int, input().split(' '))
A = list(A)

m = reduce(lcm, A, 1) - 1

fm = 0
for ai in A:
    fm += m % ai

print(fm)

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
ans = 0














num = 1
for i in a:
    num = num * i
num = num - 1
for i in a:
    ans += num % i







print(ans)

Solution (Python):
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

def lcm(a, b):
	return a * b // gcd (a, b)

N = int(input())
a = list(map(int,input().split()))

m = 1
for i in range(N):
	m = lcm(a[i], m)
m -= 1

ans = 0
for i in range(N):
	ans += m % a[i]

print(ans)

Solution (Python):
N=int(input())
num=list(map(int,input().split()))
print(sum(num)-N)

Solution (Python):
import math
from functools import reduce

N = int(input())
A= list(map(int,input().split( )))

def gcd(x,y):
    if x > y:
        x , y = y , x
    while x>0:
        x, y = y%x , x
    return y
    
def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


m =  lcm_list(A) -1

B = 0

for j in range(len(A)):
    B += m%A[j]

print(B)

Solution (Python):
n = input()
a_li = list(map(int,input().split()))

f = 0
for i in range(len(a_li)) :
    f = f + a_li[i] - 1

print(f)

Solution (Python):

import fractions
from functools import reduce


def main():
    N = int(input().strip())
    A = [int(x) for x in input().strip().split()]
    lcm = lcm_list(A) - 1
    print(f(lcm, A))

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)


def f(m, A):
    result = 0
    for i in A:
        result += m % i
    return result


if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
a = [int(x) for x in input().split()]

print(sum(a) - N)

Solution (Python):
n = input()
xs = [int(x) for x in input().split()]

print(sum(x-1 for x in xs))

Solution (Python):





N = int(input())
A = list(map(int, input().strip().split()))

limit = 1
highest = 0
for a in A:
    limit *= a
    highest += a-1


max_f = 0
i = limit
while True:
    f = 0
    for a in A:
        f += i % a
    if f > max_f:
        max_f = f
    if max_f == highest:
        break
    if i==0:
        break
    i -= 1
print(max_f)

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
print(sum(a)-N)

Solution (Python):

def main():
    n = int(input())
    a = list(map(int,input().split()))

    """
    gcd = a[0]
    lcm =0
    for i in range(1,len(a)):
        gcd = math.gcd(gcd,a[i])
        lcm = reduce(mul,a[:i+1])//gcd
        print(gcd)
        
        
    """
    ans= 0
    for i in a:
        ans += (i-1)

    print(ans)


if __name__ == "__main__":
        main()

Solution (Python):
def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = a % b
    return gcd(b, c)

def lcm(x,y):
	return (x * y) // gcd(x,y)

N = int(input())
a = list(map(int,input().split()))
a.sort()
tlcm = lcm(a[0],a[1])

for i in range(2,len(a)):
	tlcm = lcm(a[i],tlcm)

tlcm = tlcm - 1
result = 0
for i in range(len(a)):
	result += tlcm % a[i]
print(result)

Solution (Python):
N = raw_input()
A = map(int, raw_input().split())

Answer=0
for Amap in A:
  Answer = Answer + Amap -1

print(Answer)

Solution (Python):
num = input()
content = input()
content = content.split()
ans = 0
for i in content:
    ans += int(i)-1
print(ans)

Solution (Python):
N = int(input())
a = list(map(int, input().split()))

sum_num = 0
for i in a:
	sum_num += i-1
print(sum_num)

Solution (Python):

import math
import operator
from functools import reduce
def gcd(a,b):
    c = 0
    while a != b:
        if a&1==b&1==0:
            a, b = a>>1, b>>1
            c += 1
        elif min(a,b) == 0:
            a = max(a,b)
        else:
            a, b = max(a,b)%min(a,b), min(a,b)
    return a*2**c


def lcm(a,b):
    return (a*b)//gcd(a,b)

def solve():
    N = int(input())
    *A, = map(int, input().split())
    m = reduce(lcm, A) - 1
    s = sum([m%a for a in A])

    return str(s)

if __name__ == '__main__':
    print(solve())

Solution (Python):
def gcd(a, b):
    a,b = min(a,b),max(a,b)
    while b:
	    a, b = b, a % b
    return a


def lm(a,b):
    return a*b // gcd(a,b)

N =input()
list = input().split(" ")
int_li = [int(s) for s in list]

m = 1
for i in int_li:

    m = lm(m,i)
m-=1

ans = 0
for i in int_li:
    ans += m%i

print(ans);

Solution (Python):
N=int(input())
l=list(map(int,input().split()))
print(sum(l)-N)

Solution (Python):

import math

n = int(input())
a = list(map(int, input().split()))

def f(m,a):
    ans=0
    for i in a:
        ans+=m%i
    return ans

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm_list(numbers):
    ans=numbers[0]
    for i in range(1,len(numbers)):
        ans=lcm_base(ans,numbers[i])
    return ans

m= lcm_list(a)-1
print(f(m,a))

Solution (Python):
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)

def mod_(a_list, m):
    sum_ = 0
    for a in a_list:
        sum_ += m % a

    return sum_


n = int(input())
a = list(map(int, input().split(" ")))

lcm_ = lcm_list(a)

print(mod_(a, lcm_-1))

Solution (Python):
def gcd(m,n):
    while n!=0:
        l=n
        n=m%n
        m=l
    return m

def lcm(p,q):
    return p*q//gcd(p,q)

N=int(input())
a=list(map(int,input().split(' ')))
lcm_=lcm(a[0],a[1])
for i in range(2,len(a)):
    lcm_=lcm(lcm_,a[i])
result=0
m=lcm_-1
for i in a:
    result+=m%i
print(result)

Solution (Python):
n = int(input())
A = list(map(int, input().split()))
print(sum(A)-n)

Solution (Python):
N = input()
a = map(int, raw_input().split())
print(sum(a) - N)

Solution (Python):



import functools

n = input()
a = list(map(int,input().split()))

mod = functools.reduce(lambda x,y: x*y, a)

print(sum([(mod-1)%i for i in a]))

Solution (Python):
N = int(input())
a = list(map(int, input().split(' ')))
print(sum(a) - N)

Solution (Python):
N = int(input())
L = list(map(int,input().split()))
answer = 0
for i in range(N) :
    L[i] -= 1
    answer += L[i]

print(sum(L))

Solution (Python):
n=int(input())
a=list(map(int,input().split()))

print(sum(a)-len(a))

Solution (Python):
N = int(input())
A = list(map(int, input().split()))

num = sum(a - 1 for a in A)
print(num)

Solution (Python):
N = int(input())
A = [int(i) for i in list(input().split())]
sum = 0

for i in range(N):
    sum += A[i] - 1
    
print(sum)

Solution (Python):
N = int(input())
a = list(map(int, input().split()))

m = 1
for a_ in a:
    m *= a_
m -= 1
f = 0
for a_ in a:
    f += m % a_
print(f)

Solution (Python):
def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = a % b
    return gcd(b, c)

def lcm(x, y):
    return (x*y)//gcd(x, y)

N = int(input())
a = list(map(int, input().split()))
lcm2 = 1
for i in range(N):
    lcm2 = lcm(a[i], lcm2)
lcm2 -= 1
f = 0
for i in range(N):
    f += lcm2%a[i]
print(f)

Solution (Python):
from fractions import gcd

n = int(input())
A = list(map(int, input().split()))

lcm = A[0]
for i in range(1,len(A)):
    g = gcd(lcm, A[i])
    lcm = lcm * A[i] // g

f = 0
for a in A:
    f += (lcm-1) % a
print(f)

Solution (Python):
N=int(input())
A=list(map(int,input().split(" ")))

x=1
for a in A:
    x*=a

print(sum(list(map(lambda a:(x-1)%a,A))))

Solution (Python):
from fractions import gcd
from functools import reduce

n = int(input())
a = list(map(int, input().split()))

a = sorted(a)

def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

temp = lcm_list(a) - 1

result = 0
for i in a:
    result += temp % i

print(result)

Solution (Python):
def main():
        run()

def run():
        n = int(input())
        data = [int(x) for x in input().split(" ")]

        max_sum = 0 
        max_m = max(data)

        for num in data:
                max_sum += num - 1
        print(max_sum)



if __name__ == "__main__":
        main()

Solution (Python):


if __name__ == '__main__':
    N = int(input())
    A = list(map(int, input().split()))
    f = 0
    
    sum = 0
    for a in A:
        sum += (a - 1)
    print(sum)

Solution (Python):
inp = [input() for _ in range(2)]
n = int(inp[0])
a = inp[1].split()

sum = 0
for i in a:
    sum += (int(i) - 1)
print(sum)

Solution (Python):
from functools import reduce

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a * b // gcd (a, b)

def multi_lcm(numbers):
    return reduce(lcm, numbers, 1)

n = int(input())
a = [int(i) for i in input().split()]

a_lcm = multi_lcm(a)
x = a_lcm - 1

score = 0
for i in range(n):
    score += x % a[i]

print(score)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))

x = 1
for i in a:
    x *= i

ans = 0
for i in a:
    ans += (x - 1) % i

print(ans)

Solution (Python):

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+(k%m[i])
print(answer)

Solution (Python):
def gcd(x, y):
   while(y):
       x, y = y, x % y

   return x

def lcm(x, y):
   lcm = (x*y)//gcd(x,y)
   return lcm

cnt = int(input())
nums = [int (i) for i in input().split(" ")]
badnumber = 1
answer = 0
for i in range(0,cnt):
	badnumber = lcm(nums[i],badnumber)
badnumber=badnumber-1
for i in range(0,cnt):
	answer=answer+badnumber%nums[i]
print(answer)

Solution (Python):
from functools import reduce

def gcd(a, b):
    while b > 0:
        a, b = b, a%b
    return a

def lcm(a, b):
    return a*b // gcd(a, b)

def lcm_list(a):
    return reduce(lcm, a)


def func(m, a):
    val = 0
    for i in a:
        val += m % i
    return val


def main():
    n = input()
    a = list(map(int, input().split(' ')))
    itrmax = lcm_list(a)

    
    max_val = func(itrmax-1, a)
    print(max_val)


if __name__ == '__main__':
    main()

Solution (Python):


n = int(raw_input())

l = map(int, raw_input().split())

c = 1
for a in l:
	c=c*a

ret= sum([(c-1)%a for a in l])
print ret

Solution (Python):
n = int(input())
lst = list(map(int, input().split()))

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

def lcm(x, y):
    return (x * y) // gcd(x, y)

koubai = lst[0]
for i in range(n):
    if i != 0:
        koubai = lcm(lst[i], koubai)
vol = 0        
for i in range(n):
    vol += (koubai - 1) % lst[i]
print(vol)

Solution (Python):
N=int(input())
A=list(map(int,input().split()))

"""
for i in A:
    B=2*i-1
    res_pre=0
    for j in A:
        res_pre+=B%j
        if(res<res_pre):
            res=res_pre

B=2*A[0]-1
for i in range(0,A[0]-1):
    res_pre=0
    for j in A:
        res_pre+=(B-i)%j
    print(res_pre)
    if(res<res_pre):
        res=res_pre

print(res)

for i in range(0,1100000):
    res=0
    for j in A:
        res+=i%j
    if(res==90):
        print("Y")
        print(i)
"""
res=1
resres=0
for i in A:
    res*=i
res-=1
for i in A:
    resres+=res%i
print(resres)

Solution (Python):
def gcd(x, y):
 
   while(y):
       x, y = y, x % y
 
   return x

   
n = int(input())

a = list(map(int,input().split()))
lcm = a[0]
for i in a[1:]:
  lcm = (lcm * i) // int(gcd(lcm, i)) 

lcm -= 1
ans = 0
for i in a:
	ans += lcm % i 
print(ans)

Solution (Python):
N = raw_input()
print sum(map(lambda x: x - 1, map(int, raw_input().split())))

Solution (Python):
N=int(input())
a=list(map(int, input().rstrip().split()))
work=int()
Multiple=int(1)
Output=int(0)
def gcd(x,y):
    while y>0:
        x, y=y, x%y
    return x
for i in range(N):
    Multiple=int((Multiple*a[i])//gcd(Multiple, a[i]))
for i in range(N):
    Output+=(Multiple-1)%a[i]
print(Output)