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



Sample input:
3
3 4 6


Sample output:
10

Submission status: Accepted

Solution code:
import math
N = int(input())
lsa = list(map(int,input().split()))
lcm = lsa[0]
for i in range(1,N):
    lcm = lcm*lsa[i]//math.gcd(lcm,lsa[i])
m = lcm-1
ans = 0
for i in range(N):
    ans += m % lsa[i]
print(ans)

Submission status: Accepted

Solution code:
[n]=[int(i) for i in input().split()]
li=[int(i) for i in input().split()]

#print(li)

ans=0
for i in li:
    ans+=i

print(ans-n)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
def lcm(a,b):
  return a*b//math.gcd(a,b)

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

Submission status: Accepted

Solution code:
n = int(input())
L = list(map(int,input().split()))

from math import gcd
from functools import reduce

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    n=int(input())
    a=list(map(int,input().split()))
    print(sum(a)-n)
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
ans = 0

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

print(ans)

Submission status: Accepted

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

import math

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

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a=int(input())
b=list(map(int,input().split()))
c=sum(b)
print(c-a)

Submission status: Accepted

Solution code:
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=ans-1
b=0

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())
l = list(map(lambda x: int(x)-1,input().split()))

print(sum(l))

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

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

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

Submission status: Accepted

Solution code:
import math
from functools import reduce

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

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

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

Submission status: Accepted

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

ans = 0

for i in a:
  ans += i-1

print(ans)

Submission status: Accepted

Solution code:
import math
N = int(input())
a = list(map(int, input().split()))
ans = a[0]
for i in range(1, N):
    ans = ans * a[i] // math.gcd(ans, a[i])

tmp = ans - 1
mod = 0
f = 0
for i in range(N):
    mod = tmp % a[i]
    f += mod
print(f)

Submission status: Accepted

Solution code:
import math
from functools import reduce


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

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


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

MOD = lcm_list(A)-1

ans = 0
for a in A:
  ans += MOD%a
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
l=list(map(int,input().split()))
c=0
for i in l:
    c+=i-1
print(c)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def f(m):
    ans = 0
    for i in range(len(a)):
        ans += m%a[i]
    return ans

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

print(sum(a)-n)

Submission status: Accepted

Solution code:
N = input().rstrip()
res = 0
for a in map(int, input().split()):
    res += a-1
print(res)

Submission status: Accepted

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

print(sum(a)-n)

Submission status: Accepted

Solution code:
n = int(input())
ans = list(map(int,input().split()))

print(sum(ans)-n)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
N = int(input())
an = list(map(int,input().split()))

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

Submission status: Accepted

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

ans=[]
for ai in a:
  ans.append(ai-1)

print(sum(ans))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
K = int(input())
a = map(int,input().split())
print(sum(a)-K)

Submission status: Accepted

Solution code:
import math
from functools import reduce

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

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

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

Submission status: Accepted

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

if __name__=='__main__':
    main()

Submission status: Accepted

Solution code:
import fractions
def lcm(a, N):
    ans = a[0]
    for i in range(1, N):
        ans = ans * a[i] // fractions.gcd(ans, a[i])
    return ans

def main():
  N = int(input())
  A = list(map(int,input().split()))
  num = lcm(A, N) - 1
  answer = 0
  for i in A:
    answer += num % i
  print(answer)

if __name__=='__main__':
    main()

Submission status: Accepted

Solution code:
# coding:utf-8
n = int(input())
a = list(map(int, input().split()))
print(sum(a) - n)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    a_lst = list(map(int, input().split()))
    maximum = sum(a_lst) - n
    
    print(maximum)
    

if __name__ == '__main__':
    main()

Submission status: Accepted

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

print(sum(a) - n)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0

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

print(ans)

Submission status: Accepted

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

def gcd(x, y):
    x, y = min(x, y), max(x, y)
    while True:
        mod = y % x
        if mod == 0:
            break
        y = x
        x = mod

    return x

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

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

Submission status: Accepted

Solution code:
import typing
n = int(input())
a = list(map(int, input().split()))

def gcd(x : int, y : int):
    x, y = min(x, y), max(x, y)
    while True:
        mod = y % x
        if mod == 0:
            break
        y = x
        x = mod

    return x

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

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

Submission status: Accepted

Solution code:
import math
n = int(input())
a = list(map(int, input().split()))
lcm = a[0]
for i in range(1, n):
    lcm = lcm * a[i] // math.gcd(lcm, a[i])

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

# m = Aの最小公倍数 - 1
# m % a = (a - 1)
ans = sum(A) - N
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys;      from decimal import Decimal
import math;     from itertools import combinations, product
import bisect;   from collections import Counter, deque, defaultdict

# sys.setrecursionlimit(10 ** 6)
MOD = 10 ** 6 + 7
INF = 10 ** 9
PI = 3.14159265358979323846

def read_str():      return sys.stdin.readline().strip()
def read_int():      return int(sys.stdin.readline().strip())
def read_ints():     return map(int, sys.stdin.readline().strip().split())
def read_str_list(): return list(sys.stdin.readline().strip().split())
def read_int_list(): return list(map(int, sys.stdin.readline().strip().split()))
def lcm(a: int, b: int) -> int: return (a * b) // math.gcd(a, b)

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

if __name__ ==  '__main__':
    Main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
from functools import reduce

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)
    
def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

if __name__ == '__main__':

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

    ans = lcm(*A) - 1

    tmp = 0
    for i in A:
        tmp += ans % i
    print(tmp)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(lambda a:int(a), input().split(" ")))
print(sum(A) - len(A))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


def main():
    n = ni()
    print(sum(list(map(lambda x: x - 1, nl()))))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

print(sum(a) - N)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys


def input():
    return sys.stdin.readline().strip()
# sys.setrecursionlimit(100000)


def main():
    n = int(input().strip())
    A = [int(i) for i in input().split()]
    print(sum(A) - n)

    return


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline

def main():
    number = int(input())
    numbers=[]
    numbers=list(map(int,input().split()))
    answer=0
    for i in numbers:
        answer+=i-1
    print(answer)

if __name__=="__main__":
    main()

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, *A = map(int, read().split())

    print(sum(A) - N)

    return


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
input()
*a,=map(int,input().split())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    inlis = list(map(int, input().split()))

    print(sum(inlis)- n)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
print(-int(input())+eval(input().replace(" ","+")))

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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


import math

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



s = 0

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

print(s)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(sum(al)-n)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def resolve():
    import math
    from functools import reduce
    
    def lcm_base(x, y):
        return (x * y) // math.gcd(x, y)
      
    def lcm_list(numbers):
        return reduce(lcm_base, numbers, 1)
    
    n = int(input())
    A = list(map(int, input().split()))
    lcm = lcm_list(A)
    m = lcm-1
    ans = 0
    for i in range(n):
      ans += m % A[i]
    print(ans)
resolve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

import math
from functools import reduce

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

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

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

print (ans)

Submission status: Accepted

Solution code:
n = int(input())
A = [int(i) for i in input().strip().split()]

print(sum(A) - n)

Submission status: Accepted

Solution code:
import math
from functools import reduce

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

m=reduce(lambda x,y: (x*y)//math.gcd(x,y), A, 1)
print(sum((m-1)%i for i in A))

Submission status: Accepted

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

# 最小公倍数 - 1になりそうな気がする


print(sum(A) - N)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# 合計が最大になるのは、余りが各aにおいてa-1となるとき。
n = int(input())
a = list(map(int, input().split()))
# 各aから1ずつ引くをn繰り返しているため。
ans = sum(a) - n
print(ans)

Submission status: Accepted

Solution code:
import math

n = int(input())
a = list(map(int, input().split()))
common_num = 1
for num in a:
    common_num = (common_num * num) // math.gcd(common_num, num)
total = 0
for num in a:
    total += (common_num - 1) % num
print(total)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
ar=[int(i)-1 for i in input().strip().split(" ")]
print(sum(ar))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

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

print(sum(a)-n)

Submission status: Accepted

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

print(sum(a)-n)

Submission status: Accepted

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

ans = sum(a)-n

print(ans)

Submission status: Accepted

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

print(sum(a) - N)

Submission status: Accepted

Solution code:
N = int(input())
arr = list(map(int, input().split()))

print(sum(arr)-N)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from functools import reduce
import math

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

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

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

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

m=lcm_list(a)-1

ans = 0

for num in a:
    ans+=m%num

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()
print(sum(int(x)-1 for x in input().split()))

Submission status: Accepted

Solution code:
#coding: utf-8

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# abc103_c.py
# https://atcoder.jp/contests/abc103/tasks/abc103_c

# C - Modulo Summation /
# 実行時間制限: 2 sec / メモリ制限: 1024 MB
# 配点 : 300点

# 問題文
# N個の正整数 a1,a2,...,aNが与えられます。
# 非負整数 mに対して、f(m)=(m mod a1)+(m mod a2)+...+(m mod aN)とします。
# ここで、X mod Yは X を Yで割った余りを表します。
# fの最大値を求めてください。

# 制約
#     入力は全て整数である
#     2≤N≤3000
#     2≤ai≤10^5

# 入力
# 入力は以下の形式で標準入力から与えられる。
# N
# a1 a2 ... aN


# 出力
# fの最大値を出力せよ。

# 入力例 1
# 3
# 3 4 6

# 出力例 1
# 10

# f(11)=(11 mod 3)+(11 mod 4)+(11 mod 6)=10が fの最大値です。

# 入力例 2
# 5
# 7 46 11 20 11

# 出力例 2
# 90

# 入力例 3
# 7
# 994 518 941 851 647 2 581

# 出力例 3
# 4527


def calculation(lines):
    N = int(lines[0])
    values = list(map(int, lines[1].split()))
    # ☆3000近くの大きな素数をいっぱい並べた時に、これじゃだめだと思う。
    return [sum(values) - N]


# 引数を取得
def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines


# テストデータ
def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['3', '3 4 6']
        lines_export = [10]
    if pattern == 2:
        lines_input = ['5', '7 46 11 20 11']
        lines_export = [90]
    if pattern == 3:
        lines_input = ['7', '994 518 941 851 647 2 581']
        lines_export = [4527]
    return lines_input, lines_export


# 動作モード判別
def get_mode():
    import sys
    args = sys.argv
    if len(args) == 1:
        mode = 0
    else:
        mode = int(args[1])
    return mode


# 主処理
def main():
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(2)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    # if mode > 0:
    #     print(f'lines_input=[{lines_input}]')
    #     print(f'lines_export=[{lines_export}]')
    #     print(f'lines_result=[{lines_result}]')
    #     if lines_result == lines_export:
    #         print('OK')
    #     else:
    #         print('NG')


# 起動処理
if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

#mの初期値
result = 0
for a in an:
    result += (a -1)

print(result)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(sum(A) - n)

Submission status: Accepted

Solution code:
import math
from functools import reduce
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
n = int(input())
a = list(map(int, input().split()))

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

print(ans)

Submission status: Accepted

Solution code:
import math
from functools import reduce

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

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

n = int(input())
an = list(map(int, input().split()))
l = lcm(an)-1
an = [l%i for i in an]
print(sum(an))

Submission status: Accepted

Solution code:
if __name__ == '__main__':
	
	n = int(input())
	A = list(map(int,input().split()))

	print(sum(A)-n)

Submission status: Accepted

Solution code:
import sys
import numpy as np
input = sys.stdin.readline


def log(*args):
    print(*args, file=sys.stderr)


def main():
    np.set_printoptions(threshold=20)
    N = int(input())
    a = list(map(int, input().rstrip().split()))
    print(sum(a) - N)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
import numpy as np
input = sys.stdin.readline


def log(*args):
    print(*args, file=sys.stderr)


def main():
    np.set_printoptions(threshold=20)
    N = int(input())
    a = list(map(int, input().rstrip().split()))
    ans = 0
    for v in a:
        ans += v - 1
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

print(sum(A) - N)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#103_C
import math
from functools import reduce

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

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

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

lcm = lcm_list(a)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def s(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")

n = k()
a = l()

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

ans -= 1
for i in a:
    cnt += ans % i

print(cnt)

Submission status: Accepted

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

# t = np.lcm.reduce(a)
ans = 0
# for i in a:
#     ans = ans + (t-1) % i
# print(a)
# print(ans)

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

Submission status: Accepted

Solution code:
import math
from functools import reduce

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

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

n=int(input())
a=list(map(int,input().split()))
b=0
c=lcm_list(a)-1

for A in a:
	b+=c%A

print(b)

Submission status: Accepted

Solution code:
n = list(map(int, input()))[0]
a = list(map(int, input().split()))

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

Submission status: Accepted

Solution code:
import math



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

gcd = num_list[0]
mult = 1

for i in range(n):
    gcd = math.gcd(gcd,num_list[i])
    mult = mult*num_list[i]

mod_num = gcd*mult-1

c = 0

for i in range(n):
    c += mod_num % num_list[i]

print(c)

Submission status: Accepted

Solution code:
import math
def LCM(A):
    X = A[0]
    for I in range(1,len(A)):
        X = (X*A[I])//math.gcd(X,A[I])
    return X
  
N = int(input())
A = [int(I) for I in input().split()]
MAX = LCM(A)-1
FA  = [MAX%I for I in A]
print(sum(FA))

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

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

print(sum(a)-N)

Submission status: Accepted

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

print(sum(a)-N)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
from functools import reduce


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


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


_ = int(input())
a = list(map(int, input().split()))
ans = 0

gcd = lcm_list(a)-1

for i in a:
    ans += gcd % i

print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
n,*a=map(int,open(0).read().split())
print(sum(a)-n)

Submission status: Accepted

Solution code:
# n, m, l = map(int, input().split())

# list_n = list(map(int, input().split()))

# n = input()
# list = [input() for i in range(N)

# list = [[i for i in range(N)] for _ in range(M)]

import sys
input = sys.stdin.readline

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
 
N = int(input().rstrip('\n'))
numbers = list(map(int,input().rstrip('\n').split()))

print(sum(numbers)-N)