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 sys
sys.setrecursionlimit(1000000)
#def input():
#    return sys.stdin.readline()[:-1]

'''
n=int(input())
for i in range(n):
    a[i]=int(input())
    a[i],b[i]=map(int,input().split())
a=[int(x) for x in input().split()]
n,m=map(int,input.split())

'''

test_data1 = '''\
A??C
'''

test_data2 = '''\
ACACAC
'''

test_data3 = '''\
7
994 518 941 851 647 2 581
'''

test_data4 = '''\
?AC?AC
'''
td_num=3

def GetTestData(index):
    if index==1:
        return test_data1
    if index==2:
        return test_data2
    if index==3:
        return test_data3
    if index==4:
        return test_data4
    
if False:
    with open("../test.txt", mode='w') as f:
        f.write(GetTestData(td_num))
    with open("../test.txt") as f:
        # Start Input code ---------------------------------------
        n=int(f.readline())
        a=[int(x) for x in f.readline().split()]
        # End Input code ---------------------------------------
else:
    # Start Input code ---------------------------------------
    n=int(input())
    a=[int(x) for x in input().split()]
    # End Input code ---------------------------------------
#print(n,a,sum(a)-n)
print(sum(a)-n)

Submission status: Accepted

Solution code:
input();print(eval(input().replace(' ','-1+'))-1)

Submission status: Accepted

Solution code:
import numpy as np
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.sort() # 昇順にsort
ans = sum(A) - N 
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-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 pf(s): return print(s, flush=True)

N = I()
A = LI()

def f(num):
    return sum([num%a for a in A])
# 最大値の２倍-1まで順に探索していく
res = []
#  for i in range(max(A)*2+1):
#  for i in range(46*20*11*7):
#  for i in range(994*941*851):
res = 0
#  for i in range(10**7):
#  for i in range(min(A)-1, min(A)):
#  for i in range(max(A)-1, 10**10, max(A)):
#      # 他のすべての余りがa - 1になれば終了
#      for a in A:
#          if i % a != a - 1:
#              break
#      else:
#          print()
#      res = max(res, f(i))
#  print(res)
print(sum([a-1 for a in A]))

Submission status: Accepted

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

Submission status: Accepted

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

print(sum(A)-n)

Submission status: Accepted

Solution code:
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())
Ai = list(map(int, input().split()))

l = 1
for a in Ai:
    l = lcm(l, a)
l -= 1

total = 0
for a in Ai:
    total += l % a
print(total)

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:
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)//reduce(gcd, a) - 1
ans = 0
for i in range(len(a)):
    ans += max_m % a[i]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
input = open(0).read

N, *an = [int(i) - 1 for i in input().split()]
N += 1


def main():
    print(sum(an))
    return


main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np
n = int(input())
a = list(map(int, input().split()))
f = 0
ans = np.cumsum(a) - n
print(ans[-1])

Submission status: Accepted

Solution code:
import numpy as np
N = int(input())
lst = np.array(list(map(int, input().split() )))
print(np.sum(lst) -N)

Submission status: Accepted

Solution code:
N = int(input())

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

print(sum(l)-N)

Submission status: Accepted

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


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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

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


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

Submission status: Accepted

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


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


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # 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()))

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

Submission status: Accepted

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

Submission status: Accepted

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

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(numbers):
    return reduce(lcm_base, numbers, 1)
N = int(input())
nums= list(map(int,input().split()))
ans = 0
lcmnum= lcm(nums)-1
for num in nums:
    ans+=(int(lcmnum)%num)
print(ans)

Submission status: Accepted

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

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

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

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

Submission status: Accepted

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

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

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

print(sums)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
# /user/bin/python
# -*- coding: utf-8 -*-

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

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

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

Submission status: Accepted

Solution code:
n=int(input())

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

print(sum(X)-n)

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

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

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_list(numbers):
    return reduce(lcm_base, numbers, 1)


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

m = lcm_list(A) - 1

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

Submission status: Accepted

Solution code:
# https://qiita.com/_-_-_-_-_/items/34f933adc7be875e61d0
# abcde	s=input()	s='abcde'
# abcde	s=list(input())	s=['a', 'b', 'c', 'd', 'e']
# 5(1つだけ)	a=int(input())	a=5
# 1 2	| x,y = map(int,input().split())   |	x=1,y=2
# 1 2 3 4 5 ... n 　	li = input().split()	li=['1','2','3',...,'n']
# 1 2 3 4 5 ... n 　	li = inpl()	li=[1,2,3,4,5,...,n]
# FFFTFTTFF 　	li = input().split('T')	li=['FFF', 'F', '', 'FF']

# INPUT
# 3
# hoge
# foo
# bar
# ANSWER
# n=int(input())
# string_list=[input() for i in range(n)]

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


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

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

Submission status: Accepted

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

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

m = lcm_list(a_list) - 1

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

Submission status: Accepted

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

Submission status: Accepted

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

print(sum)

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

f = 0

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

Submission status: Accepted

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

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)
m = a[0]
for ai in a:
    m = lcm(m, ai)

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

print(f(m-1))

Submission status: Accepted

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

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

Submission status: Accepted

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

ans = 0
for i in lst:
    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:
n = int(input())
a = list(map(int, input().split()))

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

Submission status: Accepted

Solution code:
import sys

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


if __name__ == '__main__':
  main()

Submission status: Accepted

Solution code:
n=int(input())
a=[int(i) for i in input().split()]
#print(n,a)
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 A:
    ans += i -1

print(ans)

Submission status: Accepted

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

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

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

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

Submission status: Accepted

Solution code:

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from functools import reduce
import math
import fractions

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

def steins_gcd(a, b) : 
    a = int(a)
    b = int(b)
  
    # GCD(0, b) == b; GCD(a, 0) == a, 
    # GCD(0, 0) == 0  
    if (a == 0) : 
        return b 
      
    if (b == 0) : 
        return a 
  
    # Finding K, where K is the  
    # greatest power of 2 that  
    # divides both a and b.  
    k = 0
      
    while(((a | b) & 1) == 0) : 
        a = a >> 1
        b = b >> 1
        k = k + 1
          
    # Dividing a by 2 until a becomes odd  
    while ((a & 1) == 0) : 
        a = a >> 1
  
    # From here on, 'a' is always odd.  
    while(b != 0) : 
          
        # If b is even, remove all  
        # factor of 2 in b  
        while ((b & 1) == 0) : 
            b = b >> 1
  
        # Now a and b are both odd. Swap if 
        # necessary so a <= b, then set  
        # b = b - a (which is even). 
        if (a > b) : 
          
            # Swap u and v. 
            a, b = b, a
  
        b = (b - a) 
      
    # restore common factors of 2  
    return int(a << k)

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


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

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

    lcm_a = int(reduce(lcm, a_s))

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

Submission status: Accepted

Solution code:
n=int(input())
L=list(map(int, input().split()))
print(sum(L)-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_list(numbers):
    return reduce(lcm_base, numbers, 1)

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

i = lcm_list(aList)-1
result = 0

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

Submission status: Accepted

Solution code:
N = int(input())
a = input().split(" ")
a = [int(i) for i in a]
list = []
x = 1
for i in range(N):
  x *= a[i]
#print(x)
i = x-1
#print(a)
while True:
    temp = 0
    for j in range(N):
        temp += i % a[j]
    #print(temp)
    list.append(temp)
    #print(list)
    if i >= 3:
        if list[i-(x-1)] == 0:
            print(list[i-1-(x-1)])
            break
    i += 1


#print(max(list))
#print(list)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
def f(m):
    sum = 0
    for a in A:
        sum += m % a
    return sum
# max = 0
# for i in range(0, 1000000):
#     N = f(i)
#     if N > max:
#         max = N
# print(max) # rangeの範囲じゃ限界しかない
A = map(lambda x: x - 1, A)
print(sum(A))

Submission status: Accepted

Solution code:
#!/mnt/c/Users/moiki/bash/env/bin/python
def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = a % b
    return gcd(b, c)
def lcd(a,b):
    return a*b//gcd(a,b)
from functools import reduce
# N,M = map(int, input().split())
N = int(input())
a = list(map(int, input().split()))


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

Submission status: Accepted

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


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

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

Submission status: Accepted

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

Submission status: Accepted

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

ans = sum(li) - len(li)

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


main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import fractions

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

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

Submission status: Accepted

Solution code:
from functools import reduce
import sys
input = sys.stdin.readline

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

Submission status: Accepted

Solution code:
N = int(input())

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

print(sum(a)-N)

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict
import math
def LI(): return list(map(int, input().split()))
def II(): return int(input())
def LS(): return input().split()
def S(): return input()
def LIR(n): return [LI() for i in range(n)]
mod = 1000000007

#A

#B

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

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T

Submission status: Accepted

Solution code:
#A
"""n,k =map(int, input().split())

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import fractions

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

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

print(function)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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


    print(sum(a) - N)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

main()

Submission status: Accepted

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

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

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

re_ans = 0
ans -= 1

for i in A:
    re_ans += ans % i

print(re_ans)

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

Submission status: Accepted

Solution code:
def a():return input()#s
def ai():return int(input())#a,n or k
def ma():return map(int, input().split())#a,b,c,d or n,k
def ms():return map(str, input().split())#,a,b,c,d
def lma():return list(map(int, input().split()))#x or y
def lms():return list(map(str, input().split()))#x or y
a = ai()
x = lma()
print(sum(x)-a)

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

Submission status: Accepted

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

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

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

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)  # 再帰定義

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


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

koubai = 1

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

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

ans = 0

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

Submission status: Accepted

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

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

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

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

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

Submission status: Accepted

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

if __name__ == '__main__':
    piyo()

Submission status: Accepted

Solution code:
from math import log10

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

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

Submission status: Accepted

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

print(sum(aList) - N)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(sum)

Submission status: Accepted

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

A.sort()

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

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

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

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

Submission status: Accepted

Solution code:
N = int(input())

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

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

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(m)

Submission status: Accepted

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


abc103_c()

Submission status: Accepted

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


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


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


#print(calcMod(a, reduce(mul, a)-1))
print(sum(a)-n)

Submission status: Accepted

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


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


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


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