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

Submission status: Accepted

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

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

print(sum(a)-N)

Submission status: Accepted

Solution code:
# ABC103c
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

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

Submission status: Accepted

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

print(sum(nums) - N)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


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

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

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

    print(ans2)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import fractions
from functools import reduce

n = int(input())
a = list(map(int, input().split()))
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

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

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
m = lcm(*a)

ans = 0

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

Submission status: Accepted

Solution code:
import fractions
N = int(input())
ans = 0
for i in map(int,input().split()):
    ans += i
ans -= N
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:
from fractions import gcd
from functools import reduce
N = int(input())
A = list(map(int, input().split()))
M = reduce(lambda x,y: x*y//gcd(x,y),A)-1
print(sum(M%a for a in A))

Submission status: Accepted

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


main()

Submission status: Accepted

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


main()

Submission status: Accepted

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


main()

Submission status: Accepted

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


main()

Submission status: Accepted

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


main()

Submission status: Accepted

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

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

print(sum(A) - N)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# きりみんちゃんのtwから来ました
# サンプルを眺めて、mがなんなのかはわからんけどとりあえずai(0<=i<n)ごとの ai mod mの最大値はai-1ということが生える（生えたよ）
# なので、mがなんなのかはわからんけど、とりあえずaiそれぞれの最大値を足した
n = int(input())
print(sum(list(map(lambda x: int(x) - 1, input().split()))))

Submission status: Accepted

Solution code:
import sys
import fractions


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


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


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

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

m = a_lcm - 1
ans = 0

for ai in a:
    ans += m%ai

print(ans)

Submission status: Accepted

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

print(c_modulo_summation())

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:
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

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

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

N = int(sys.stdin.buffer.readline())
A = list(map(int, sys.stdin.buffer.readline().split()))

A = np.array(A, dtype=int)
ans = (A - 1).sum()

print(ans)

Submission status: Accepted

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

ans = 0
m = 1
for i in range(0,n):
    m *= a[i]
m -= 1
for j in range(0,n):
    ans += m % a[j]
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:
import fractions
from functools import reduce
N = int(input())
A = [int(i) for i in input().split()] 

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

l = reduce(lcm, A)

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

Submission status: Accepted

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

ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
import sys

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

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

if __name__ == '__main__':
    ans = main()
    print(ans)

Submission status: Accepted

Solution code:

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

from functools import reduce
from fractions import gcd

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

l = reduce(lcm, A) - 1


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

Submission status: Accepted

Solution code:
n = int(input())
v = [int(x) for x in input().split()]
running = 0
for x in v:
  running += x-1
print(running)

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()))
import fractions
ans = A[0]
for i in range(1, N):
    ans = ans * A[i] // fractions.gcd(ans, A[i])
# print(ans)
count = 0
for a in A:
    count += (ans-1) % a
print(count)

Submission status: Accepted

Solution code:
N = int(input())
*A, = map(int, input().split())
sum = 0

for i in range(len(A)):
    sum = sum + (A[i]-1)%A[i]

print(sum)

Submission status: Accepted

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

print(sum(A))

Submission status: Accepted

Solution code:
import sys
import itertools
input = sys.stdin.readline
N = int(input())
li = [int(i) for i in input().split()]
sum = 0
for i in range(N) :
    sum += li[i]- 1
print(sum)

Submission status: Accepted

Solution code:
import sys
import itertools
import numpy
input = sys.stdin.readline
N = int(input())
li = [int(i) for i in input().split()]
sum = 0
for i in range(N) :
    sum += li[i]- 1
print(sum)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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


def solve(N: int, a: "List[int]"):
    print(sum(a)-N)
    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))  # type: int
    a = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, a)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
from fractions import gcd

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

cross_num = 1
for a in A:
    cross_num *= a
num = cross_num-1

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

print(ans)

Submission status: Accepted

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

import fractions
def LCM(a,b):
  G=fractions.gcd(a,b) #最大公約数
  L=(a//G)*b           #最小公倍数
  return L

lcm = a[0]
for b in a[1:]:
  lcm = LCM(lcm,b)
ans = 0
print(sum([(lcm-1)%ai for ai in a]))

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
import fractions
def lcm(a,b):
    lcm=fractions.gcd(a,b)
    return lcm
m=1
for i in range(n):
    m=lcm(m,a[i])
    
print(sum(a)-n)

Submission status: Accepted

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

print(sum(a_list) - N)

Submission status: Accepted

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

B = []
for i in range(len(A)):
    B.append(int(A[i] - 1))

print(sum(B))

Submission status: Accepted

Solution code:
import fractions
from functools import reduce
def _lcm(x, y):
    return (x*y)//fractions.gcd(x, y)
def lcm(*l):
    return reduce(_lcm, l)

N = int(input())
a = [int(x) for x in input().split()]
l = lcm(*a)
print(sum((l-1)%a[i] for i in range(N)))

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

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    N = I()
    A = LI()
    ans = 0
    for a in A:
        ans += (a-1)
    print(ans)

main()

Submission status: Accepted

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

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

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

m = 1

for i in a:
    m = lcm(m, i)

m -= 1
ans = 0

for e in a:
    ans += m % e

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

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

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:
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 sys
import numpy as np
input = sys.stdin.readline
N = int(input())
a = np.array([int(x) for x in input().split()])
a -= 1
print(a.sum())

Submission status: Accepted

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

n = int(input())
a = list(map(int,input().split()))
#aをすべてかけて1を引いた整数をmにすればよい
print(sum(a)-len(a))

Submission status: Accepted

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

n = int(input())
a = list(map(int,input().split()))
#aをすべてかけて1を引いた整数をmにすればよい
print(sum(list(map(lambda x:x-1,a))))

Submission status: Accepted

Solution code:
import sys
readline = sys.stdin.readline
n = int(readline())
print(sum([int(i) for i in readline().split()]) - n)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
print(-int(input())+sum(int(i) for i in input().split()))

Submission status: Accepted

Solution code:
import math
from functools import reduce
import fractions

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

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

lcm = lcm_list(l)
a = lcm-1
mod_all = 0

for i in l:
    mod_all += a%i

print(mod_all)

Submission status: Accepted

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

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

c = ans -1

#print(c)
ans = 0
for val in a:
    ans += c%val
print(ans)

Submission status: Accepted

Solution code:
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()))
lm=a[0]
for i in range(1,n):
    lm=lcm(lm,a[i])
lm-=1
res=0
for i in a:
    res+=lm%i
print(res)

Submission status: Accepted

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

print(sum(l)-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:
import sys
sys.setrecursionlimit(10**6)
if sys.platform in (['ios','darwin','win32']):
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return [int(s) for s in input().split()]

N = INT()
A = MAP()

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

lcm = A[0]
for i in range(1, len(A)):
	#リストA（N個）の最小公倍数
	lcm = lcm * A[i] // gcd(lcm, A[i])

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import fractions
from functools import reduce


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

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


N = int(input())
seq = list(map(int, input().split()))
lcm_num = lcm(seq)

ans = 0
for num in seq:
    ans += (lcm_num - 1) % num

print(ans)

Submission status: Accepted

Solution code:
def examC():
    N = I(); A = LI()
    ans = sum(A)-N
    print(ans)

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examC()

Submission status: Accepted

Solution code:
import fractions


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


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

Submission status: Accepted

Solution code:
import sys
import numpy as np

n = int(sys.stdin.readline())
A = list(map(int, sys.stdin.readline().split()))

print(sum(A)-n)

Submission status: Accepted

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

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

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

a_lcd=1
for i in range(len(a)):
  a_lcd=lcd(a_lcd,a[i])
  
div=a_lcd-1
ans=0
for i in range(len(a)):
  ans+=div%a[i]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
n = int(input())
a_ls = [int(i) for i in sys.stdin.readline().split()]
print(sum(a_ls) - n)

Submission status: Accepted

Solution code:
num = int(input())
val_list = [int(i) for i in input().split()]

ans = 0

for val in val_list:
    ans += (val -1)

print(ans)

Submission status: Accepted

Solution code:
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 = input()
L = list(map(int, input().split()))
UL = set(L)
LC = lcm_list(UL) - 1
ANS = 0
for i in L:
  ANS += LC % i
print(ANS)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect, string, copy
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
mod = 10**9+7
ans = count = 0; pro = 1

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
#最大公約数
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
  
#最小公倍数
def lcm(a, b):
    return a * b // gcd (a, b)

#全体の最小公倍数は？
l = a[0]  
for i in range(1,n):
  l = lcm(l,a[i])

#答えは(最小公倍数−１)%a[i]の合計  
ans = 0  
for i in range(n):
  ans += (l-1) % a[i]
print(ans)

Submission status: Accepted

Solution code:
from fractions import gcd
from functools import reduce


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


N = int(input())
A = [int(i) for i in input().split()]
# 公倍数-1を代入すると最大
max_m = reduce(product,A)-1
ans = 0
for a in A:
    ans += max_m%a
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())
L = list(map(int, input().split()))
out = 0
for i in range(n):
  out += L[i] - 1
  
print(out)

Submission status: Accepted

Solution code:
from functools import reduce
from fractions import gcd
n = int(input())
L = [int(i) for i in input().split()]
def lcm(x,y):return x*y//gcd(x,y)
def lcmm(l):return reduce(lcm,l)
ans = 0
m = lcmm(L)-1
ans = sum([m%i for i in L])
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from fractions import gcd
N=int(input())
L=list(map(int,input().split()))
M=max(L)

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

p=1
for i in L:
    p=lcm(i,p)
q=0
print(sum([(p-1)%i for i in L]))

Submission status: Accepted

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

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

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

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

print(ans)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
n = input()
a = input().split()
b = []
for i in a :
    b.append(int(i));
c = 0
for i in b :
    c += i-1
print(c)

Submission status: Accepted

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

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

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

print(total)

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N =  INT()
a = LIST()

print(sum(a)-N)

Submission status: Accepted

Solution code:
from functools import reduce
n = int(input())
a = list(map(int,input().split()))
ans = 0
def gcd(a,b):
  if (b == 0):
    return a
  return gcd(b,a%b)

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

def get_lcm(numbers):
  return reduce(lcm,numbers)
l = get_lcm(a) - 1
for i in range(n):
  ans += l % a[i]
print(ans)

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=[int(i) for i in 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()))
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()))
total = sum(a)
ans = total - n
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
A = list(map(int, input().split()))
from fractions import gcd
def lcm(a, b):
  return a * b // gcd(a, b)
temp = A[0]
for i in range(n-1):
  temp = lcm(A[i+1], temp)

max_mod = sum([(temp-1) % num for num in A])
print(max_mod)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

print(sum(value)-len(value))

Submission status: Accepted

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

def LCM(x,y):
    X=max(x,y)
    Y=min(x,y)
    while X%Y!=0:
        X,Y=Y,X%Y
    return x*y//Y

cnt=A[0]
for i in range(1,N):
    cnt=LCM(cnt,A[i])
#print(cnt)

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

print(sum(A)-N)

Submission status: Accepted

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

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

Submission status: Accepted

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

print(sum(a))

Submission status: Accepted

Solution code:
N = int(input())
a = [int(i)-1 for i in input().split()]
#b = [0]*N

#for i in range(N):
#    b[i] = a[i] - 1

print(sum(a))

Submission status: Accepted

Solution code:
N = int(input())
a = [int(i) for i in input().split()]
b = [0]*N

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

Submission status: Accepted

Solution code:
from sys import stdin

n = int(stdin.readline().rstrip())
li = list(map(int,stdin.readline().rstrip().split()))

print(sum(i-1 for i in li))

Submission status: Accepted

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

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

print(m)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    n=int(input())
    A=list(map(int,input().split()))
    print(sum(A)-n)
resolve()

Submission status: Accepted

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

print(sum(a)-n)

Submission status: Accepted

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

Submission status: Accepted

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

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:
#                         author:  kagemeka 
#                         created: 2019-11-08 15:54:47(JST)
### modules
## from standard library
import sys
# import collections
# import math
# import string
# import bisect
# import re
# import itertools
# import statistics
# import functools
# import operator
## from external libraries
# import scipy.special   # if use comb function on AtCoder, 
# import scipy.misc      # select scipy.misc.comb (old version) 
# import numpy as np


def main():
    n, *a = (int(x) for x in sys.stdin.read().split())
    # editorial より
    f = sum(a) - n
    print(f)

if __name__ == "__main__":
    # execute only if run as a script
    main()

Submission status: Accepted

Solution code:
#                         author:  kagemeka 
#                         created: 2019-11-08 15:54:47(JST)
### modules
## from standard library
import sys
# import collections
# import math
# import string
# import bisect
# import re
# import itertools
# import statistics
import functools
# import operator
## from external libraries
# import scipy.special   # if use comb function on AtCoder, 
# import scipy.misc      # select scipy.misc.comb (old version) 
# import numpy as np

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

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


def main():
    n, *a = (int(x) for x in sys.stdin.read().split())

    m = functools.reduce(lcm, a)
    f = sum([(m - 1) % a[i] for i in range(n)])
    print(f)

if __name__ == "__main__":
    # execute only if run as a script
    main()

Submission status: Accepted

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

totalA = 0

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

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)
#とっぽこ(TT)#

Submission status: Accepted

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