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())
lst = np.array(list(map(int, input().split() )))
print(np.sum(lst) -N)

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

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

print(sum(l)-N)

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

print(sum(a) - N)

Solution (Python):
def solve(string):
    n, *a = map(int, string.split())
    return str(sum(a) - n)


if __name__ == '__main__':
    print(solve('\n'.join([input(), input()])))

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 x in a:
    ans+=(x-1)
print(ans)

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

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

print(ans)

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

Solution (Python):
n,*a=map(int,open(0).read().split());print(sum(a)-n)

Solution (Python):
def modulo_summation(N: int, A: list)->int:
    """f(n) = (n % a1) + ... + (n % aN) の最大値を求める。
    f(n) の各項の最大値を考えると `ai - 1` である。
    lcm(a1, a2, ..., aN) - 1 = M を考えると、任意の i について
    M = ai x M' - 1 = ai x (M' - 1) + (ai - 1)
    となり、M % ai = ai - 1 となることがわかる。したがって、n = M
    とすることで f(n) の各項は最大となり、当然 f(n) も最大となる。

    以上より、f(n) の最大値は sum(a - 1 for a in A)
    """
    return sum(a - 1 for a in A)


if __name__ == "__main__":
    N = int(input())
    A = map(int, input().split())
    ans = modulo_summation(N, A)
    print(ans)

Solution (Python):

import sys


def solve(N: int, a: "List[int]"):
    print(sum(map(lambda ai:ai-1, a)))
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    a = [ int(next(tokens)) for _ in range(N) ]  
    solve(N, a)

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

def f(m):
    ret=0
    for i in a:
        ret+=m%i
    return ret
  
print(f(-1))

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):
N=int(input())
A=list(map(int,input().split()))
m=1
for a in A:
  m*=a
m-=1
print(sum([a-1 for a in A]))

Solution (Python):
from functools import reduce
n=int(input())
a=[i-1 for i in list(map(int, input().split()))]
ans=reduce((lambda x, y:x+y), a)
print(ans)

Solution (Python):
import math
from functools import reduce
import fractions
def lcm_base(x, y):
    return (x * y)//fractions.gcd(x, y)
def lcm(numbers):
    return reduce(lcm_base, numbers, 1)
N = int(input())
nums= list(map(int,input().split()))
ans = 0
lcmnum= lcm(nums)-1
for num in nums:
    ans+=(int(lcmnum)%num)
print(ans)

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

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

n=int(input())
A=list(map(int,input().split()))
k=1
for i in A:
  k=lcm(k,i)

def f(n):
  return sum(list(map(lambda x:n%x,A)))
print(f(k-1))

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

m =1
for i in range(len(mods)):
  m *= mods[i]

sums = 0
for i in range(len(mods)):
  sums += (m-1) %mods[i]

print(sums)

Solution (Python):
N=int(input())
l=list(map(int,input().split()))
lcm=l[0]
ans=0
def gcd(a,b):
  while b:
    a,b=b,a%b
  return a

for i in range(1,N):
  lcm=lcm*l[i]//gcd(lcm,l[i])

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

Solution (Python):



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

def lcm(x_, y_):
    x, y = max(x_, y_), min(x_, y_)
    while x%y > 0:
        x, y = y, x%y
    gcd = y
    return x_*y_//gcd

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

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

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

print(sum(X)-n)

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

print(sum(l)-n)

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()))
answer = 0

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

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

m = lcm_list(A) - 1

res = 0
for a in A:
    res += m % a
print(res)

Solution (Python):


















import math
import numpy as np
import copy
from collections import defaultdict, Counter
from itertools import product
from bisect import bisect_left, bisect_right
def inpl(): return list(map(int, input().split()))


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

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

Solution (Python):
import fractions
import operator
from functools import reduce
N = int(input())
a_list = list(map(int, input().split(' ')))

def lcm_list(numbers):
    return reduce(operator.mul, numbers) // reduce(fractions.gcd, numbers)

m = lcm_list(a_list) - 1

print(sum([m % a for a in a_list]))

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):
def gcd(i,j):
    a=max(i,j)
    b=min(i,j)
    if a%b==0:
        return b
    else:
        return gcd(b,a%b)
def lcm(i,j):
    return i*j//gcd(i,j)
N=int(input())
A=list(map(int,input().split()))
l=lcm(A[0],A[1])
for i in range(2,N):
    l=lcm(l,A[i])
ans=0
for i in A:
    ans+=(l-1)%i
print(ans)

Solution (Python):
n = int(input())
listA = list(map(int, input().split()))
index=0
sum=0
while index < n:
    sum+=listA[index]-1
    index+=1

print(sum)

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

f = 0

for i in range(N):
  f += (a_n[i] - 1)
  
print(f)

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

Solution (Python):
n,*a=map(int,open(0).read().split());print(sum(a)-n)

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

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()))
from fractions import gcd
def lcm(a,b):
    return a*b//gcd(a,b)
m = a[0]
for ai in a:
    m = lcm(m, ai)

def f(x):
    ret = 0
    for ai in a:
        ret += x%ai
    return ret

print(f(m-1))

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

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

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

ans = 0
for i in lst:
    ans += (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()))

res = sum([i-1 for i in a])
print(res)

Solution (Python):
import sys

def main():
  input = sys.stdin.readline
  N = int(input())
  A = list(map(int, input().split()))
  A = [a-1 for a in A]
  print(sum(A))


if __name__ == '__main__':
  main()

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):
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 - 1 for a in A]))

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

def euclid(a, b):
    m = min(a,b)
    n = max(a,b)
    if (n%m==0):
        return m
    else:
        return euclid(m, n%m)

def lcm(X):
    a = X[0]
    for x in X[1:]:
        a = a* x // euclid(a,x)
    return a

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

Solution (Python):

int_n = int(input())
ar_int = list(map(int, input().split()))

print(sum([i - 1 for i in ar_int]))

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

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

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

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

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

memo = {}
def gcd(a, b):
    """a = bq + r"""
    if (a, b) not in memo:
        a, b = (max(a, b), min(a, b))
        if b == 0:
            memo[(a, b)] = a
        else:
            r = a % b
            memo[(a, b)] = gcd(b, r)
    return memo[(a, b)]

def steins_gcd(a, b) : 
    a = int(a)
    b = int(b)
  
    
    
    if (a == 0) : 
        return b 
      
    if (b == 0) : 
        return a 
  
    
    
    
    k = 0
      
    while(((a | b) & 1) == 0) : 
        a = a >> 1
        b = b >> 1
        k = k + 1
          
    
    while ((a & 1) == 0) : 
        a = a >> 1
  
    
    while(b != 0) : 
          
        
        
        while ((b & 1) == 0) : 
            b = b >> 1
  
        
        
        
        if (a > b) : 
          
            
            a, b = b, a
  
        b = (b - a) 
      
    
    return int(a << k)

def another_gcd(x, y):
    while y != 0:
        (x, y) = (y, x % y)
    return x


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

if __name__ == "__main__":
    n = int(input())
    a_s = list(map(int, input().split(" ")))

    lcm_a = int(reduce(lcm, a_s))

    fm = 0
    for a in a_s:
        fm += (lcm_a-1) % a
    print(fm)

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

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

print(sum(A) - N)

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

i = lcm_list(aList)-1
result = 0

for x in aList:
    result+=i%x
print(result)

Solution (Python):
N = int(input())
a = input().split(" ")
a = [int(i) for i in a]
list = []
x = 1
for i in range(N):
  x *= a[i]

i = x-1

while True:
    temp = 0
    for j in range(N):
        temp += i % a[j]
    
    list.append(temp)
    
    if i >= 3:
        if list[i-(x-1)] == 0:
            print(list[i-1-(x-1)])
            break
    i += 1

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()))
def f(m):
    sum = 0
    for a in A:
        sum += m % a
    return sum






A = map(lambda x: x - 1, A)
print(sum(A))

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 lcd(a,b):
    return a*b//gcd(a,b)
from functools import reduce

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


r = reduce(lcd, a)

ans = 0
for ea in a:
    ans += (r-1)%ea
print(ans)

Solution (Python):
def solve(N, As):
    return sum([a - 1 for a in As])


if __name__ == "__main__":
    N = int(input())
    As = list(map(int, input().split(" ")))
    print(solve(N, As))

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 a:
  Ans += i - 1
  
print(Ans)

Solution (Python):
n=int(input())
a=list(map(int,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()))
A = [i-1 for i in a]
print(sum(A))

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

Solution (Python):
n = int(input())
l = list(map(int, input().split()))
a = 0
for x in l:
  a += x - 1
print(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())
li = list(map(int, input().split()))

ans = sum(li) - len(li)

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())
L = list(map(int,input().split()))
ans = 0
for x in L:
    ans += x - 1
print(ans)

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

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

print(ans)

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


main()

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

Solution (Python):
import time
start = time.time()
N = int(input())
A = list(map(int, input().split()))
print(sum(A) - N)

Solution (Python):
import fractions

N = int(input())
A = [int(n) for n in input().split()]

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

l = 1
for a in A:
  l = lcm(a, l)
B = [(l - 1) % a for a in A]
print(sum(B))

Solution (Python):
input()
print(sum(int(a)-1 for a in input().split()))

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

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

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

n = int(input())
A = [int(i) for i in input().split()]
copyA = A.copy()

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

Solution (Python):
from functools import reduce
import sys
input = sys.stdin.readline

N = int(input())
f = reduce(lambda x, y: int(x) + int(y) - 1, input().split()) - 1
print(f)

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

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

print(sum(a)-N)

Solution (Python):

from collections import defaultdict
import math
def LI(): return list(map(int, input().split()))
def II(): return int(input())
def LS(): return input().split()
def S(): return input()
def LIR(n): return [LI() for i in range(n)]
mod = 1000000007






n = II()
a = LI()
print(sum(a)-n)

"""
s = list(S())
lis = []
sign = ["","+"]
k = 2**(len(s)-1)
d = 10-len(s)
for i in range(d):
    s.insert(0,"0")
i = 0
for a0 in range(2):
    for a1 in range(2):
        for a2 in range(2):
            for a3 in range(2):
                for a4 in range(2):
                    for a5 in range(2):
                        for a6 in range(2):
                            for a7 in range(2):
                                for a8 in range(2):
                                    if i >= k:break
                                    lis.append(s[0]+sign[a0]+s[1]+sign[a1]+s[2]+sign[a2]+s[3]+sign[a3]+s[4]+sign[a4]+s[5]+sign[a5]+s[6]+sign[a6]+s[7]+sign[a7]+s[8]+sign[a8]+s[9])
                                    i += 1
ans = 0
for i in lis:
    ans += eval(i[d:])
print(ans)
"""

Solution (Python):

"""n,k =map(int, input().split())

print(k * (k - 1)**(n - 1)) """


"""
import math
r, n, m = map(int, input().split())
kankaku = 2 * r / n
tyusin = n / 2
sum = 0
for i in range(0, n + m):
    if i - m < 0:
        yoko1 = 2*math.sqrt(r ** 2 - ((tyusin-i)*kankaku)**2 )
        sum += yoko1
    elif i > n:
        yoko2 = 2*math.sqrt(r ** 2 - ((tyusin - i + m) * kankaku)** 2)
        sum += yoko2
    else:
        yoko1 = 2*math.sqrt(r ** 2 - ((tyusin-i)*kankaku)**2 )
        yoko2 = 2*math.sqrt(r ** 2 - ((tyusin - i + m) * kankaku)** 2)
        sum += max(yoko1, yoko2)
print(sum)
"""


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

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

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

Solution (Python):
import fractions

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

def lcm(x, y):
  return (x * y) // fractions.gcd(x, y)
  
num_lcm = a[0]
for i in range(1,n):
  num_lcm = lcm(num_lcm,a[i])
  
function = 0
const = num_lcm-1
for i in range(n):
  function += const % a[i]

print(function)

Solution (Python):

def getInt(): return int(input())
def getIntList(): return [int(x) for x in input().split()]
def db(x): 
    global debug
    if debug: print(x)
debug = True
N = getInt()
a = getIntList()
print(sum(a)-N)

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

Solution (Python):


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


    print(sum(a) - N)


if __name__ == '__main__':
    main()

Solution (Python):


def main():
    n = int(input())
    an = list(map(int, input().split()))
    md = [a - 1 for a in an]
    print(sum(md))

main()

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

N = int(input())
A = [int(i) for i in input().split()]
ans = (A[0] * A[1]) // gcd(A[0], A[1])

for i in range(N):
    ans = (A[i] * ans) // gcd(A[i], ans)

re_ans = 0
ans -= 1

for i in A:
    re_ans += ans % i

print(re_ans)

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()))
ans = 0
for x in range(N):
    ans += A[x]
ans -= N
print(ans)

Solution (Python):
def a():return input()
def ai():return int(input())
def ma():return map(int, input().split())
def ms():return map(str, input().split())
def lma():return list(map(int, input().split()))
def lms():return list(map(str, input().split()))
a = ai()
x = lma()
print(sum(x)-a)

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

print(sum(a) - n)

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

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

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

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

for i in range(n-1):
    A[i+1] = lcm(A[i], A[i+1])

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

print(ans)

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

Solution (Python):
def main(a):
    print(sum([i-1 for i in a]))

if __name__ == '__main__':
    input()
    main(list(map(int, input().strip().split(' '))))

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

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


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

koubai = 1

for i in range(0,len(ar)):
    koubai = lcm(ar[i],koubai)

res = 0
koubai -= 1
for i in range(0,len(ar)):
    res += koubai % ar[i]
print(res)

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

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

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

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

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

print(sum(a_list)-len(a_list))

Solution (Python):
n = int(input())
A = [int(i) for i in input().split()]
G = A.copy()
L = A.copy()

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

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

for i in range(n - 1):
    g = gcd(G[i], A[i + 1])
    l = lcm(L[i], A[i + 1])
    G[i + 1] = g
    L[i + 1] = l

ans = 0

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

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

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

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

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

m = lcm(a_list)-1
cost = 0
for a in a_list:
    cost += m%a
print(cost)

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

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

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

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 = [int(i) for i in input().split()]
A2 = A.copy()

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

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

for i in range(n-1):
    A[i+1] = lcm(A[i], A[i+1])

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

Solution (Python):
import numpy as np
def piyo():
    a = int(input())
    b = np.array(list(int(i) for i in input().split()),dtype=int)
    print(np.sum(b)-a)

if __name__ == '__main__':
    piyo()

Solution (Python):
from math import log10

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

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

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

print(sum(aList) - N)

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

Solution (Python):
n = int(input())
a = list(int(i) for i in input().split())
print(sum(a)-len(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 = list(map(int, input().split()))
A2 = A.copy()
ans = 0

A.sort()

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

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

for i in range(n - 1):
    A[i + 1] = lcm(A[i], A[i + 1])
    
m = A[-1] - 1

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

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

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

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

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


if __name__ == '__main__':
    main()

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

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

Solution (Python):
a = int(input())
ar = list(map(int,input().split(" ")))
b = 1
c = 0
for r in ar:
  b *= r
for r in ar:
  c += (b-1) % r
print(c)

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

print(sum(li)-len(li))

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

m = 0
for a in in_list :
    m += a - 1

print(m)

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


abc103_c()

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


def calcMod(a, m):
  return sum([m % v for v in a])


def mul(a, b):
  return a*b



print(sum(a)-n)

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


def calcMod(a, m):
  return sum([m % v for v in a])


def mul(a, b):
  return a*b


print(calcMod(a, reduce(mul, a)-1))

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


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


def calcMod(a, m):
  return sum([m % v for v in a])


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


def lcm_list(l):
  g = reduce(lcm, l)
  return g


def mul(a, b):
  return a*b



print(calcMod(a, reduce(mul, a)-1))

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

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

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

Solution (Python):

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

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

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

def f(m):
    s = 0
    for i in range(n):
        s += m%al[i]
    return s

res = al[0]
for i in range(1,n):
    res = lcm(res,al[i])


print(f(res-1))

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

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

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
def gcd(x,y):
  if y==0:
    return x
  else:
    return gcd(y,x%y)
def lcm(x,y):
  return (x*y)//gcd(x,y)
z=lcm(a[0],a[1])
for i in range(2,n):
  z=lcm(z,a[i])
sum=0
for i in range(n):
  sum+=(z-1)%a[i]
print(sum)

Solution (Python):

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


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

P = mul - 1

ret = 0
for a in A:
    ret += (P % a)

print(ret)

Solution (Python):
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 = input().split()

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

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

l -= 1
s = 0

for i in range(n):
    s += l % a[i]

print(s)

Solution (Python):

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

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

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

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

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

print(sum(a) - N)

Solution (Python):
N = int(input())
an = list(map(int,input().split(" ")))
sum = 0
i = 0
while i < N:
  sum+=an[i]-1
  i+=1
print(sum)

Solution (Python):
def main():
    N = int(input())
    A = list(map(int, input().split()))
    print(sum([x-1 for x in A]))


if __name__ == "__main__":
    main()

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

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

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

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

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

print(ans)

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

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

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

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

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

sum = 0
for num in nums:
  sum += num -1
  
print(sum)

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

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

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

Solution (Python):


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

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

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().strip().split()))
ans=0
for i in range(N):
    ans+=a[i]-1
print(ans)

Solution (Python):
input()

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

Solution (Python):

input()
print(sum(int(_)-1 for _ in input().split()))

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

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

n=int(input())
l=list(map(int,input().split()))
a=0
for _ in range(n):
    a+=l[_]
print(a-n)

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

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

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 a:
    ans += i - 1
print(ans)

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

def main():
    print(sum(A) - N)

if __name__ == "__main__":
    main()

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

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

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

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

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

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

m =1
for i in range(len(mods)):
  m *= mods[i]

sums = 0
for i in range(len(mods)):
  sums += (m-1) %mods[i]

print(sums)

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

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

print(sum(a) - N)