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):





import numpy as np



n = int(input())

arrA = np.array(input().split(),dtype=np.int64)

ans = sum(arrA -1)

print(ans)

Solution (Python):
from functools import reduce
N = int(input())
a = list(map(int, input().split()))

def gcd_impl(n,m):
    K = 5
    for _ in range(80):
        t = n - m
        s = n - m*K
        q = t < m
        p = t < m*K
        if q:
            n = m
        else:
            n = t
        if q:
            m = t
        else:
            m = m
        if m == 0:
            return n
        if p:
            n = n
        else:
            n = s
    return gcd_impl(m, n%m)

def gcd_pre(n,m):
    for _ in range(4):
        t = n - m
        q = t < m
        if q:
            n = m
        else:
            n = t
        if q:
            m = t
        else:
            m = m
        if m == 0:
            return n
    return gcd_impl(n,m)

def gcd(n,m):
    if n > m:
        return gcd_pre(n,m)
    else:
        return gcd_pre(m,n)

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

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

M = lcm_list(a) - 1

res = 0
for i in a:
    res += M%i
print(res)

Solution (Python):
from functools import reduce
N = int(input())
a = list(map(int, input().split()))

def gcd_impl(n,m):
    for _ in range(10):
        t = n - m
        q = m > t
        if q:
            n = m
        else:
            n = t
        if q:
            m = t
        else:
            m = m
        if m == 0:
            return n
    return gcd_impl(m, n%m)

def gcd(n,m):
    if n > m:
        return gcd_impl(n,m)
    else:
        return gcd_impl(m,n)

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

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

M = lcm_list(a) - 1

res = 0
for i in a:
    res += M%i
print(res)

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

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

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

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

print(sum(A)-n)

Solution (Python):
import sys
import math
mod=10**9+7
inf=float("inf")
from math import sqrt
from collections import deque
from collections import Counter
input=lambda: sys.stdin.readline().strip()
sys.setrecursionlimit(11451419)
from functools import lru_cache




def gcd(a,b):
    if b==0: return a
    else:
        return gcd(b,a%b)
def lcm(a,b):
    return a*b//gcd(a,b)

n=int(input())
A=list(map(int,input().split()))
ans=A[0]
for i in range(n-1):
    ans=lcm(ans,A[i+1])

ans-=1
q=0
for i in range(n):
    q+= ans%A[i]
print(q)

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

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

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

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

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

from fractions import gcd 

x =1
for i in l:
    x = x * i // gcd(x, i)

y=0
for j in range(n):
    y+=(x-1)%l[j]

print(y)

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

from fractions import gcd 

def lcms(List):
    __ = 1
    for _ in List:
        __ =int(__ * _ // gcd(__, _))
    return __

x = lcms(l)-1

y=0
for j in range(n):
    y+=(x)%l[j]

print(y)

Solution (Python):
"""
103 C
"""

def read_input():
    n = int(input())
    alist = list(map(int, input().split()))
    return n, alist


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


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


def submit():
    n, alist = read_input()

    c = 1
    for a in alist:
        c = lcm(c, a)

    res = 0
    for a in alist:
        res += (c - 1) % a

    print(res)
    

if __name__ == "__main__":
    submit()

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

from fractions import gcd 

x =1
for i in l:
    x = x * i // gcd(x, i)

y=0
for j in range(n):
    y+=(x-1)%l[j]

print(int(y))

Solution (Python):
n = int(input())
A = list(map(int, input().split()))
t = 0

for i in A:
    t += i - 1
print(t)

Solution (Python):
import math
from functools import reduce
n = int(input())
a = list(map(int, input().split()))
def function(m, a):
  count = 0
  for i in a:
    count += m%i
  return count
def lcm_base(x, y):
    return (x * y)
def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)
max_num = lcm(*a)-1
print(function(max_num, a))

Solution (Python):
n, *a = map(int, open(0).read().split())
print(sum([i-1 for i in a]))

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

Solution (Python):
def gcd(a,b):
    while b!=0:
        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()))

ans = 0
l = 1

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

print(ans)

Solution (Python):
def gcd(a, b):
    if a > b:
        a, b = b, a
    while a % b != 0:
        a, b = b, a % b
    return b
def lcm(a, b):
    return a * b // gcd(a, b)

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

l = 1
for a in A:
    l = lcm(l, a)

print(sum((l - 1) % a for a in A))

Solution (Python):
input()
print(sum([int(x) - 1 for x in input().split()]))

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

ans = 0
for a in A:
  ans += a-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 = [int(x) for x in input().split()]

print(sum(a) - N)

Solution (Python):
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
def nlcm(lista):
    res = lista[0]
    for i in range(1,len(lista)):
        res = lcm(res,lista[i])
    return res

def main():
    
    
    
    
    
    
    
    
    
    
    
    
    
    n = int(input())
    a = list(map(int, input().split()))
    cm = nlcm(a)-1
    res = 0
    for i in a:
        res += cm % i
    print(res)

if __name__ == '__main__':
    main()

Solution (Python):
def main():
    n = int(input())
    A = list(map(int, input().split()))

    print(sum(A)-n)


if __name__ == '__main__':
    main()

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

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

print(ans)

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

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

print(s)

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

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

ans = 0

for i in t:
    ans += i-1
print(ans)

Solution (Python):
N = int(input())
ARR = [int(s) for s in input().split(" ")]
def calculate(arr,n):
    return sum(arr) - n

result = calculate(ARR,N)
print(result)

Solution (Python):
import numpy as np
from functools import reduce
from operator import add,sub,mul,truediv
from fractions import gcd

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

x = a[0]

for i in range(1,len(a)):
    x = (x*a[i])//gcd(x,a[i])

x = x-1

ans = 0
for i in range(len(a)):
    ans = ans + x%a[i]

print(ans)

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

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

def f(n,l):
    return sum([n % x for x in l])

m = 1
for x in a:
    m *= x
print(f(m-1, a))

Solution (Python):
def main():
    n = int(input())
    A = [int(e) for e in input().split()]

    ans = sum([a - 1 for a in A])
    print(ans)

if __name__ == "__main__":
    main()

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

Solution (Python):
lis=[]
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):
N = int(input())
A = list(map(lambda x: int(x) - 1, input().split()))

print(sum(A))

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

print(sum(a)-n)

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

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

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

print(sum(a_list)-N)

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

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

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

Solution (Python):
import numpy as np

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

print(sum(a - 1))

Solution (Python):
import fractions

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

ans = a[0]
for i in range(1, n):
    ans = ans * a[i] // fractions.gcd(ans, a[i])

ans-=1
ans1=0
for g in range(n):
    ans1+=ans%a[g]
print(ans1)

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

def GCD(a,b):
  if b==0: return a
  else: return GCD( b, a%b )

g = 1
for i in range(N):
  lcm = g * A[i] // GCD(g,A[i])
  g = lcm
ans = 0
for i in range(N):
  ans += (g-1) % A[i]
print(ans)

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

Solution (Python):
from itertools import accumulate
def gcd(n,m):
    n,m = max(n,m),min(n,m)
    r = n % m
    while r > 0:
        n,m = m,r
        r = n % m
    return m
def lcm(n,m):
    return n*m//gcd(n,m)
N = int(input())
a = list(map(int,input().split()))
L = list(accumulate(a, lcm))[-1]

def f(n):
    return sum([n%x for x in a])
print(f(L-1))

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

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a * b // gcd(a, b)
LCM = lcm(a[0], a[1])

for i in range(2, N):
    LCM = lcm(LCM, a[i])
answer = 0
for aN in a:
    answer += (LCM - 1) % aN
    

print(answer)

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

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

ans = 0
for i in a:
    ans += i-1

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()))

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

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 = [int(i)-1 for i in input().split()]
print(sum(a))

Solution (Python):
input()
a = [int(x) for x in input().split()]
print(sum(map(lambda x : x - 1, a)))

Solution (Python):
N = int(input())
A = [int(zz) for zz in input().split()]

print(sum(A)-N)

Solution (Python):

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

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

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

Solution (Python):
n = int(input())
AS = list(map(int,input().split()))
print(sum(AS)-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 = list(map(int, input().split()))

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

Solution (Python):

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

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

Solution (Python):
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x%y)

N = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
lcm = a[0]
for i in range(1, N):
    lcm =(lcm * a[i]) // gcd(lcm, a[i])
ans = 0
for i in a:
    ans += (lcm-1) % i
print(ans)

Solution (Python):
import fractions
from functools import reduce
def b(x, y):
    return (x * y) // fractions.gcd(x, y)
_ = int(input())
a = [int(x) for x in input().split()]
m = reduce(b, a, 1) - 1
print(sum([m % a_i for a_i in a]))

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

m = 1
for a in A:
    m*=a
m -=1
print(sum(m % a for a in A))

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

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

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):
import fractions

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

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

Solution (Python):

import math
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=list(map(int,input().split()))

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

Solution (Python):

from fractions import gcd
def lcm(a, b):
    return a*b//gcd(a, b)
N = int(input())
A = list(map(int, input().split()))
m = A[0]
for i in range(1, N):
    m = lcm(m, A[i])
ans = 0
m -= 1
for i in range(N):
    ans += m % A[i]
print(ans)

Solution (Python):
from functools import reduce
n = int(input())
a = list(map(int, input().split()))

def gcd(x, y):
    if y == 0:
        return x
    return gcd(y, x % y)
    

def gcd2(number):
    return reduce(gcd, number)

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

m = lcm2(a) - 1

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

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

Solution (Python):

from fractions import gcd
from functools import reduce


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


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


n = int(input())
a = list(map(int, input().split()))
ll = lcm_list(a) - 1
ans = 0
for i in a:
    ans += (ll % i)
print(ans)

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

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

Solution (Python):



import math
import fractions


def gcd_fgf(a, b):
    return fractions.gcd(a, b)


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


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


work_lcm = a[0]
for i in range(1, n):
    work_lcm = lcm_fgf(work_lcm, a[i])

m = work_lcm - 1


fm = 0
for i in range(n):
    fm = fm + (m % a[i])

ans = fm    

print(ans)

Solution (Python):



import math
import fractions


def gcd_fgf(a, b):
    return fractions.gcd(a, b)


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


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


work_lcm = a[0]
for i in range(1, len(a)):
    work_lcm = lcm_fgf(work_lcm, a[i])

m = work_lcm - 1


fm = 0
for i in range(len(a)):
    fm = fm + (m % a[i])

ans = fm    

print(ans)

Solution (Python):
N = int(input())
a = list(map(int, 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()))

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

print(ans)

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

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

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


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


def main():
    number = int(input())
    mods = list(map(int, input().split(" ")))
    be_divided = reduce(find_lcm, mods) - 1
    answer = 0
    for mod in mods:
        answer += be_divided % mod
    print(answer)


if __name__ == '__main__':
    main()

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

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

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

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

def lcm(ls):
  return reduce(lcm_base,ls)

def mod(ls,num):
    ans=0
    for i in range(N):
        ans+=num%ls[i]
    return ans
print(mod(a,lcm(a)-1))

Solution (Python):
s = int(input())
ss = input().split()
sss = []
for i in ss:
    sss.append(int(i))
print(sum(sss)-s)

Solution (Python):
from fractions import gcd

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

lcm=a[0]
for i in range(N):
    g=gcd(lcm,a[i])
    lcm=(lcm*a[i])//g
    
lcm-=1

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

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)

N = int(input())
alist = list(map(int, input().split()))
l = lcm_list(alist)
ans = 0
for a in alist:
    ans += (l - 1) % a
print(ans)

Solution (Python):
import fractions
N = int(input())
a = list(map(int, input().split()))
ans = a[0]
for i in range(1, N):
    ans = ans * a[i] // fractions.gcd(ans, a[i])
target = ans - 1
sum = 0
for aa in a:
    sum += target%aa
print(sum)

Solution (Python):

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

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

print(sum(numbers) - N)

Solution (Python):
N = int(input())
a = list(map(int,input().split()))
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)
mod = lcm(*a) - 1
ans = 0
for i in range(N):
	ans += mod % a[i]
print(ans)

Solution (Python):

import math
import heapq
import bisect
import numpy as np
from collections import Counter
import fractions


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

m = A[0]
for a in A:
    m = (m*a)//fractions.gcd(m,a)

ans = 0
for a in A:
    ans += (m-1)%a

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())

nums = map(int, input().split())

sum = 0

for n in nums:
    sum += n - 1

print(sum)

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

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

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

ans = 0

for i in a:
    ans += i - 1

print(ans)

Solution (Python):
from fractions import gcd
N = int(input())
A = list(map(int, input().split()))

lcs = 1
for i in range(N):
    lcs = (lcs * A[i]) // gcd(lcs, A[i])
ans = 0
for i in range(N):
    ans += (lcs-1) % A[i]
print(ans)

Solution (Python):
import fractions
import functools

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

lcm = functools.reduce(lambda x, y: (x * y) // fractions.gcd(x, y), a) - 1

print(sum(map(lambda x: lcm % x,a)))

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

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=[int(x) for x in input().split()]

ans=0

for aa in a:
    ans+=aa-1

print(ans)

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()))
print(sum(a)-n)

Solution (Python):
from functools import reduce

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

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

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

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

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

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())
a = list(map(int, input().split()))
print(sum(a)-n)

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

ans = 0
for i in a_n:
  ans += i - 1

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()))

ans = 0

for i in range(N):
    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 = list(map(int, input().split()))
ans = 0
x = lcm_list(a) - 1
for i in range(n):
  ans += x%a[i]
print(ans)

Solution (Python):

import sys
import math
import os
import itertools

class cin():
    def int():
        return int(sys.stdin.readline().rstrip())
    def string():
        return sys.stdin.readline().rstrip()
    def mapInt():
        return [int(x) for x in cin.string().split()]
    def stringList(n):
        return [input() for i in range(n)]

class Util():
    def round_up(a,b):
        return -(-a // b)
    def toUpperMultiple(a,x):
        return Util.round_up(a,x) * x
    def toLowerMultiple(a,x):
        return (a // x) * x

N = cin.int()
A = cin.mapInt()
print(sum(A) - N)

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

print(sum([x - 1 for x in a]))

Solution (Python):
import sys

stdin = sys.stdin

mod = 1000000007

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()
nas = lambda: stdin.readline().split()

def gcd(m, n):
	if n == 0:
		return m
	return gcd(n, m % n)

def lcm(m, n):
	return m * n // gcd(m, n)

n = ni()
a = na()

l = a[0]
for i in range(n):
	l = lcm(l, a[i])

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

print(ans)

Solution (Python):
import fractions
n = int(input())
a = list(map(int, input().split()))
val = a[0]
for i in range(1, n):
    val = val*a[i] // fractions.gcd(val,a[i])
m = val -1

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

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

print(sum(A)-N)

Solution (Python):
N=int(input())
A=list(map(int,input().split()))
  
import fractions
a=A[0]
for i in range(1, N):
    a=a*A[i]//fractions.gcd(a,A[i])
a-=1
ans=0
for i in A:
  ans+=a%i
print(ans)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
s = []
m = 1

def f(m, a):
    s_tmp = 0
    for i in range(n):
        s_tmp = s_tmp + m % a[i]
    return s_tmp

for i in range(n):
    m = m * a[i]

print(f(m-1, a))

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

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()))

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

Solution (Python):
from fractions import gcd

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

lcm = 1
for i in range(n):
    lcm = (lcm * a[i]) // gcd(lcm, a[i])
arg = lcm - 1
ans = 0
for i in range(n):
    ans += (arg % a[i])
print(ans)

Solution (Python):
def minus1int(x):
  return int(x) - 1

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

print(sum(a))

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

Solution (Python):
xs = map(int, input().split())
xs = map(int, input().split())
r = 0
for x in xs:
    r += x-1
print(r)

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

if __name__ == "__main__":
    main()

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
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

n = int(input())
a = list(map(int, input().split()))
ans = 0
f = 0
for j in a:
    f += j-1

ans = max(ans, f)
print(ans)

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

print(sum(nums) - N)

Solution (Python):
N = int(input())
a = list(map(int,input().split()))
def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b,a%b)
def lcm(a,b):
    gcda = gcd(a,b)
    return a*b//gcda
def lcmlist(lista):
    if len(lista) == 1:
        return lista[0]
    else:
        from functools import reduce
        return reduce(lcm,lista)
lcma = lcmlist(a)-1
ans = 0
for i in a:
    ans += lcma%i
print(ans)

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

Solution (Python):
from fractions import gcd
n = int(input())
c = list(map(int, input().split()))
a = 1
for b in c:
    a = a * b // gcd(a, b)
x = 0
for i in c:
    x += (a-1)%i
print(x)

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

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

Solution (Python):
import sys
input = sys.stdin.readline
import fractions


def main():
    N = int(input())
    a = [int(x) for x in input().split()]
    
        

    ans = 1
    for v in a:
        ans = (ans * v) // fractions.gcd(ans, v)

    ans2 = 0
    for v in a:
        ans2 += (ans - 1) % v

    print(ans2)


if __name__ == '__main__':
    main()

Solution (Python):
n=int(input())
A=list(map(int,input().split()))
def gcd(a,b):
    if b>a:
        return gcd(b,a)
    if b==0:
        return(a)
    else:
        return gcd(b,a%b)
g=A[0]
seki=A[0]
for i in range(1,n):
    g=gcd(g,A[i])
    seki*=A[i]
lcm=seki//(g**(n-1))
cnt=0
for j in range(n):
    cnt += (lcm-1) % A[j]
print(cnt)

Solution (Python):
n=int(input())
A=list(map(int,input().split()))
def gcd(a,b):
    if b>a:
        return gcd(b,a)
    if b==0:
        return(a)
    else:
        return gcd(b,a%b)
g=A[0]
seki=A[0]
for i in range(1,n):
    g=gcd(g,A[i])
    seki*=A[i]
lcm=seki//(g**(n-1))
cnt=0
for j in range(n):
    cnt += (lcm-1) % A[j]
print(cnt)

Solution (Python):
from fractions import gcd
n=int(input())
A=list(map(int,input().split()))
l=A[0]
for i in range(n-1):
	l=(l*A[i+1])//gcd(l,A[i+1])
r=0
for i in range(n):
	r+=(l-1)%A[i]
print(r)

Solution (Python):
import fractions
from functools import reduce

n = int(input())
a = list(map(int, input().split()))
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)
m = lcm(*a)

ans = 0

for i in range(n):
    ans += (m - 1) % a[i]
print(int(ans))

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

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

Solution (Python):
from fractions import gcd
from functools import reduce
N = int(input())
A = list(map(int, input().split()))
M = reduce(lambda x,y: x*y//gcd(x,y),A)-1
print(sum(M%a for a in A))

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()))
    print(sum(a) - N)
    return


main()

Solution (Python):
def main():
    N = int(input())
    *a, = map(int, input().split())
    print(sum(a) - N)
    return


main()

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


main()

Solution (Python):
def main():
    N, *a = map(int, open(0).read().split())
    print(sum(a) - N)
    return


main()

Solution (Python):
def main():
    N, *a = [int(i) - 1 for i in open(0).read().split()]
    print(sum(a))
    return


main()

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(a,b):
    if a<b:
        a,b = b,a
    if b==0:
        return a
    else:
        return gcd(b,a%b)

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

ans = a[0]
for i in range(n-1):
    ans = lcm(ans,a[i+1])
ans-=1
ans2 = 0
for i in range(n):
    ans2 += ans%a[i]
    
print(ans2)

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

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

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

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

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

print(sum(A) - N)

Solution (Python):
A = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(A):
    ans = ans + a[i] - 1
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)-N)

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

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

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

total = 0
for i in lst:
    total += (i-1)
print(total)

Solution (Python):



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

Solution (Python):
import sys
import fractions


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


def input():
    return sys.stdin.readline().strip()


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

a_lcm = a[0]
for ai in a:
    a_lcm = lcm(ai, a_lcm)

m = a_lcm - 1
ans = 0

for ai in a:
    ans += m%ai

print(ans)

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

print(c_modulo_summation())

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

print(c_modulo_summation())

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