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 sys
import fractions


def solve(N: int, a: "List[int]"):
    ans = sum(a) - N
    print(ans)
    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):
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(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
k=0
m=lcm_list(a)-1
for i in range(n):
    k+=m%a[i]
print(k)

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_list(numbers):
    return reduce(lcm_base, numbers, 1)
  
ans = lcm_list(a) - 1
print(sum([ans % ai for ai in a]))

Solution (Python):
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)
from fractions import gcd

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

def main():
    N = int(readline())
    A = list(map(int, readline().rstrip().split()))

    l = lcm_base(A[0], A[1])
    for a in A[2:]:
        l = lcm_base(l, a)
    
    l -= 1
    print(sum([l % a for a in A]))


if __name__ == '__main__':
    main()

Solution (Python):
def myAnswer(N:int,A:list) -> int:
   return sum(A) - N

def modelAnswer():
   tmp=1
def main():
   N = int(input())
   A = list(map(int,input().split()))
   print(myAnswer(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()))

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

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

ans=0

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

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

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

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

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

Solution (Python):
import fractions
n = int(input())
A = list(map(int,input().rstrip().split(' ')))
def lcm(a,b):
  return int(a*b//fractions.gcd(a,b))
L=1
for x in A:
  L=lcm(L,x)
L-=1
ans=0
for x in A:
  ans+=L%x
print(ans)

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

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

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

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

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

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

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

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

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

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(0, n):
    ans += a[i] - 1
print(ans)

Solution (Python):
import math, sys
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from copy import deepcopy
from functools import lru_cache
from heapq import heapify, heappop, heappush
from itertools import accumulate, combinations, permutations
from fractions import gcd
input = sys.stdin.readline
mod = 10**9 + 7
ns = lambda: input().strip()
ni = lambda: int(input().strip())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

n = ni()
a = nl()

lcm = a[0]
ans = 0
for num in a[1:]:
    lcm = lcm * num // gcd(lcm, num)

for num in a:
    ans += (lcm - 1) % num

print(ans)

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

Solution (Python):
def func(a):
  return int(a) - 1
n = int(input())
alist = list(map(func,input().split()))
print(sum(alist))

Solution (Python):
import sys

n, *a = map(int, sys.stdin.read().split())

def main():
    print(sum(a) - n)

if __name__ ==  '__main__':
    main()

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

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

print(ans)

Solution (Python):





mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    n = int(input())
    A = readInts()
    print(sum(A) - len(A))



if __name__ == '__main__':
  main()

Solution (Python):
import sys
IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))
from itertools import accumulate as acc
def gcd(a,b):
    while b: a, b = b, a%b
    return a
def lcm(a,b):
    return a*b//gcd(a,b)
def main():
    n = II()
    aa = MII()
    ll = list(acc(aa, lcm))
    lv = ll[-1]-1
    sumv = 0
    for a in aa:
        sumv += lv%a
    print(sumv)

if __name__ == '__main__':
    main()

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

sumans = 0
for i in range(n):
  sumans += a[i]
  
print(sumans - 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()))

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

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

answer = A[0]
Sum = 0

def gcd(A,B):
    if(B == 0):
        return A
    else:
        return gcd(B, A%B)


for i in range(1, N):
    answer = answer * A[i] // gcd(answer, A[i])
    
for i in range(N):
    Sum += (answer-1) % A[i]

print(Sum)

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

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

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

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

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

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

import fractions


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

mn = 0

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

print(mn)

Solution (Python):
f_max = int(input()) * -1

for x in input().split():
    f_max+=int(x) 


print(f_max)

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

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

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

print(sum(L)-n)

Solution (Python):

from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
import numpy as np
from functools import reduce

from collections import deque, Counter, defaultdict
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7
def lcm(a, b):
  return a*b//gcd(a, b)

def main():
  n = int(readline())
  a = list(map(int, readline().split()))
  k = reduce(lcm, a) - 1
  ans = 0
  for i in range(n):
    ans += k % a[i]
  print(ans)
  
  
  
  
  
if __name__ == '__main__':
  main()

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

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

def lcm(x,y):
    return x*y//gcd(x,y)
ans=1
for num in a:
    ans=lcm(ans,num)
    
ans-=1

x=0
for num in a:
    x+=ans%num
print(x)

Solution (Python):
import fractions

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

lcm=1
for a in alist:
  lcm=lcm*a//fractions.gcd(lcm,a)
  

answer=0
for a in alist:
  answer+=(lcm-1)%a
  
print(answer)

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

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

Solution (Python):
import fractions
n = int(input())
a_list = list(map(int, input().split()))
m = 1
for a in a_list:
    m = a * m // fractions.gcd(m, a)

ans = sum([(m - 1) % a for a in a_list])
print(ans)

Solution (Python):
import sys
import os

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

MOD = 10 ** 9 + 7


def func(q, A):
    return sum(q % a for a in A)


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    A = il()
    q = 1
    for a in A:
        q *= a
    ret = func(q - 1, A)
    print(ret)


if __name__ == '__main__':
    main()

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

n = input()
a = list(map(int,input().split()))
gd = reduce(gcd,a)
m = reduce(lambda a,b: a*b,a)//gd -1
sum = sum(map(lambda x: m%x,a))

print(int(sum))

Solution (Python):
from fractions import gcd
def lcm(x,y):
    return (x*y)//gcd(x,y)

n=int(input())
a=list(map(int,input().split()))
t=0
for i,aa in enumerate(a):
    if i==0:
        t=a[0]
        continue
    t=lcm(t,aa)

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

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

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

Solution (Python):
from fractions import gcd
N = int(input())
a = list(map(int, input().split()))
def lcm(A):
  x = A[0]
  for i in range(1, len(a)):
    x = (x * A[i]) // gcd(x, A[i])
  return x

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

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

Solution (Python):

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

Solution (Python):
def sum_div(args):
    result = 0
    for a in args:
        result += int(a) - 1
    return result


def main():
    input()
    print(sum_div(input().split()))


if __name__ == '__main__':
    main()

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


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


def main():
    n = int(input())
    a = list(map(int, input().split()))
    m = reduce(lcm, a) - 1
    ans = 0
    for aa in a:
        ans += m % aa
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n = ii()
A = iil()
print(sum(A)-n)

Solution (Python):
def resolve():
    N = int(input())
    A = list(map(int, input().split(" ")))
    subA = list(map(lambda x: x-1, A))
    print(sum(subA))

if '__main__' == __name__:
    resolve()

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

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

x = lcm(*a)

x = x - 1
result = 0
for i in a:
    result += x % i

print(result)

Solution (Python):
import fractions

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

lcm=1
for a in alist:
  lcm=lcm*a//fractions.gcd(lcm,a)
  

answer=0
for a in alist:
  answer+=(lcm-1)%a
  
print(answer)

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

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

n=int(input())
a=[int(i) for i in input().split()]
l=1
for i in range(n):
    l=lcm(l,a[i])
s=0
l-=1
for i in range(n):
    s+=(l%a[i])
print(int(s))

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):
lennum = int(input())
numlist = list(map(int, input().split()))
_list = [i for i in numlist if i > 1]
dst = sum(_list) - len(_list)
print(dst)

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

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

nums = [int(i) for i in input().split()]
ans = 0
for num in nums:
    ans += (num - 1)
print(ans)

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

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

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

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

l = nums[0]
for num in nums:
    l = lcm(num, l)
l -= 1
ans = 0
for num in nums:
    ans += l % num
print(ans)

Solution (Python):
import sys
import numpy as np


import fractions
from collections import deque 
from functools import reduce

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

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


n = int(input())


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

lcm_1 = lcm_list(a) - 1
m = np.mod(lcm_1, a)
print(m.sum())

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

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


x = functools.reduce(func, a)
print(sum([(x-1) % val for val in a]))

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

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


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


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

l = 0
for i in range(1, len(A)):
    l = lcm(A[i - 1], A[i])
ans = l - 1
ans = sum(A) - len(A)
print(ans)

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

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

Solution (Python):
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    
    from itertools import combinations, permutations, accumulate, groupby
    
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    

    
    

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

if __name__ == '__main__':
    main()

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

def lcm_base(x, y):
    return (x * y) // 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())
a = list(map(int,input().split()))
m = lcm(*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=0
for i in range(N):
  ans+=a[i]-1
print(ans)

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

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

Solution (Python):


import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
a = LI()
ans = 0
for i in a:
    ans += i-1
print(ans)

Solution (Python):

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


def ngcd(a):
    res = a[0]
    for i in range(len(a)):
        if res != 1:
            res = gcd(a[i], res)
    return res


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


def nlcm(a):
    res = a[0]
    for i in range(len(a)):
        res = lcm(res, a[i])
    return res

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

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

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

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

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

Solution (Python):

import collections


def solve():
    N = int(input())
    As = list(map(int, input().split()))

    print(sum(As)-len(As))


if __name__ == "__main__":
    solve()

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

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

Solution (Python):

def Modulo(n , al):

    return sum(al) - n

def main():
    n = int(input())
    al = list(map(int , input().split()))
    print(Modulo(n , al))

if __name__ == '__main__':
    main()

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

Solution (Python):
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 

def ii(): return int(sys.stdin.readline().rstrip()) 
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) 
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]

def ss(): return sys.stdin.readline().rstrip() 
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) 
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]





from fractions import gcd
from functools import reduce
def lcm_base(x, y):
    return (x * y) // gcd(x, y)

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

n=ii()
arr=limii()
p=lcm(arr)-1

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

Solution (Python):
def main(n, a):
    ans = 0

    for i in a:
        ans += i - 1

    print(ans)


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

    main(n, a)

Solution (Python):

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


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


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


alcm = a[0]
for i in a[1:]:
  alcm = lcm(alcm, i)

res = 0


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

print(res)

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

Solution (Python):
from fractions import gcd
n = int(input())
a = list(map(int, input().split()))
x = a[0]
ans = 0
for i in range(1, len(a)):
    x = (x * a[i]) // gcd(x, a[i])
for j in a:
    ans += (x - 1) % j
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):
import fractions

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

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

ans = 0
for i in a:
    ans += (m%i)

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

sum = 0
for ai in a:
    sum += ai
print(sum - 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 lcm(a):
    from fractions import gcd
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
    return x

ans = 0
pi = 1

for i in range(N):
    pi *= a[i]

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

Solution (Python):

def solve():
    N = int(input())
    As = list(map(int, input().split()))

    print(sum(As)-len(As))



if __name__ == "__main__":
    solve()

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

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

Solution (Python):
import fractions

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

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

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

    
print(f(m-1))

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

from fractions import gcd

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

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

f = lcm_list(a)-1
ans = 0

for i in a:
    ans += f%i

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):
from fractions import gcd
n = int(input())
a = list(map(int, input().split()))
x = a[0]
ans = 0
for i in range(1, len(a)):
    x = (x * a[i]) // gcd(x, a[i])
for j in a:
    ans += (x - 1) % j
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()))
x=0
for i in range(len(a)):
    x += a[i]
print(x-N)

Solution (Python):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

n = INT()
a = LIST()
print(sum(a) - n)

Solution (Python):

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

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

Solution (Python):
import numpy as np
n = int(input())
A = np.array(list(map(int, input().split())))

ans = (A-1).sum()
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()))
ans = sum(A) - N
print(ans)

Solution (Python):








import sys
sys.setrecursionlimit(10 ** 5 + 10)


def resolve():

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

    print(sum(A)-N)
resolve()

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()))
l = lcm(a[0],a[1])
for i in range(2,N):
    l = lcm(l,a[i])
ans = 0
for i in range(N):
    ans += (l-1)%a[i]
print(ans)

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

Solution (Python):
from fractions import gcd

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




LCM = a[0]
for i in range(1, n):
    LCM = (LCM*a[i]) // gcd(LCM, a[i])
LCM -= 1

ans = 0
for i in a:
    ans += LCM % i
print(ans)

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

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

k=1
for item in a:
  k=k*item//gcd(k,item)

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

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

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

Solution (Python):
N = input()

print(sum([int(s)-1 for s in input().split()]))

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()

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

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

if __name__ == '__main__':
    main()

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

print(sum(A)-n)

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)


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

    lcm_A = A[0]
    for a in A:
        lcm_A = lcm(lcm_A, a)

    result = 0
    for a in A:
        result += (lcm_A - 1) % a

    print(result)


if __name__ == "__main__":
    main()

Solution (Python):
from __future__ import print_function

import sys

import re
import array
import copy
import functools
import operator

import math
import string
import fractions
from fractions import Fraction
from fractions import gcd



import collections
import itertools
import bisect

import random
import time

import heapq
from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace
from queue import PriorityQueue as pq
from queue import Queue

from itertools import accumulate

from collections import deque
from collections import Counter

from operator import mul
from functools import reduce

input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return


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


def coprimize(p, q):
    common = fractions.gcd(p, q)
    return (p // common, q // common)


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


def find_gcd(list_l):
    x = reduce(gcd, list_l)
    return x


def main():
    n = int(input().strip())
    a = list(map(int, input().strip().split()))
    
    print(sum(a)-n)

if __name__ == '__main__':
    main()

Solution (Python):
from fractions import gcd
n = int(input())
a = list(map(int,input().split()))
def lcm(x, y):
	return (x*y) // gcd(x, y)
aa = a[0]
for i in a[1:]:
	aa = lcm(aa,i)


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

Solution (Python):
from fractions import gcd
n = int(input())
a = list(map(int,input().split()))
def lcm(x, y):
	return (x*y) // gcd(x, y)
aa = a[0]
for i in a[1:]:
	aa = lcm(aa,i)
if aa-max(a) <= 0:
	aa += aa
s = 0
for i in a:
	s += (aa-1)%i
print (s)

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

print(sum(a) - N)

Solution (Python):
n = int(input())
a = [int(i) for i in input().split()]
print(sum(a) - len(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) - len(a))

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

Solution (Python):
from fractions import gcd

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

p = A[0]
for a in A:
    p = (p * a) // gcd(p, a)

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

print(ans)

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

from fractions import gcd

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

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

m -= 1

ans = 0
for a in A:
    ans += m % a

print(ans)

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):
import numpy
N = int(input())
L = [i-1 for i in map(int,input().split())]
res = numpy.sum(L)
print(res)

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

Solution (Python):
import bisect




import itertools



import sys



ipti = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)

def main():
    n = int(input())
    a = list(map(int,ipti().split()))
    ans = sum(a) - n
    print(ans)

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