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:
from functools import reduce
n = (int)(input())
a = (list)(map(int, input().split()))


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


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


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


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


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


#print(calcMod(a, (int)(lcm_list(a)-1)))
print(calcMod(a, reduce(mul, a)-1))

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
n = int(input())
al = list(map(int, input().split()))

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

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

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

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


print(f(res-1))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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


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

P = mul - 1

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

print(ret)

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

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

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

l -= 1
s = 0

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

print(s)

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:
n = int(input())
a = input().split()
s = 0
for i in range(n):
    s += int(a[i])
print(s - n)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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:
#ABC103C
#任意の数の組に対して、最小公倍数は必ず得られる。それから1を引くとmが得られる。
N=int(input())
a=list(map(int,input().split()))
print(sum(a)-N)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
input()
#print(sum(int(_)-1 for _ in input().split()))
print(sum(map(lambda x:int(x)-1,input().split())))

Submission status: Accepted

Solution code:

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

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:
import sys
import string
input=sys.stdin.readline

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

Submission status: Accepted

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

Submission status: Accepted

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

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

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 = [int(a) for a in input().split()]
print(sum(a_list)-n)

Submission status: Accepted

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

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

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

print(sum(a) - N)

Submission status: Accepted

Solution code:
#!/usr/bin/env python
input()
print(sum(map(lambda x: int(x) - 1, input().split())))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N  = int(input())
list = [0]*N
list[0:N] = map(int,input().split()) 
result = sum(list)-N
print(result)

Submission status: Accepted

Solution code:
def modulo(n, a):
    return sum(a) - n

n = int(input())
a = map(int, input().split())
print(modulo(n, a))

Submission status: Accepted

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

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())
numbers=list(map(int,input().split()))
m=lcm(*numbers)-1
ans=0
for i in range(n):
    ans+=m%numbers[i]
print(ans)

Submission status: Accepted

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

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())
H = [int(i) for i in input().split()]
print(sum(H)-N)

Submission status: Accepted

Solution code:
input()
ans = 0
for a in map(int, input().split()):
    ans += a - 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())
an = map(lambda x:x-1, list(map(int,input().split(" "))))
print(sum(an))

Submission status: Accepted

Solution code:
# Modulo Summation
input()
a = list(map(int, input().split()))
x = 1
for i in a:
    x *= i
print(sum(list(map(lambda j: (x - 1) % j, a))))

Submission status: Accepted

Solution code:
def gcd(m, n):
    if n == 0:
        return m
    return gcd(n, m % n)


def m():
    n = int(input())
    a = list(map(int, input().split()))
    tmp = a[0]
    ans = 0
    modv = tmp
    for i in range(1, n):
        tmp = gcd(modv, a[i])
        modv = (modv*a[i] // tmp)
    for i in range(n):
        ans += (modv-1) % a[i]
    return ans
print(m())

Submission status: Accepted

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

s=0
for i in a:
  s+=i-1
print s

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
l = [int(_) for _ in input().split()]

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

Submission status: Accepted

Solution code:
import fractions
n = int(input())
lis = list(map(int,input().split()))
cou = 1
for i in range(n):
  cou = (cou * lis[i])//fractions.gcd(cou, lis[i])
cou -= 1
print(sum([cou % lis[i] for i in range(n)]))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
C - Modulo Summation
https://beta.atcoder.jp/contests/abc103/tasks/abc103_c

"""
import sys
from sys import stdin
input = stdin.readline


from fractions import gcd

def solve(arr):
    def calc_sum(m, arr):
        return sum([m%a for a in arr])

    def calc_lcm(arr):
        t = arr[0]
        for a in arr[1:]:
            t = t * a // gcd(t, a)
        return t

    lcm = calc_lcm(arr)
    return calc_sum(lcm-1, arr)


def main(args):
    N = int(input())
    arr = [int(a) for a in input().split()]
    ans = solve(arr)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

Submission status: Accepted

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

print(sum(array)-n)

Submission status: Accepted

Solution code:
n = int(input())                                                                                                                     
a = map(int, input().split())                                                                               
print(sum([aa-1 for aa 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:
N = int(input())
print(sum(map(lambda c: int(c)-1, input().split())))

Submission status: Accepted

Solution code:
import fractions
from functools import reduce

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

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

m = reduce(lcm, a) - 1
print(sum(map(lambda a: m % a, a)))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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(raw_input())
l = map(int, raw_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())
list_a = list(map(int,input().split()))
a = 0
for i in range(N):
    a += list_a[i]-1
print(a)

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

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

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:
#coding:utf-8

n = int(raw_input())
a = map(int,raw_input().split())

print sum(a) - n

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

n = int(raw_input())
a = map(long, raw_input().split())
lcm = 1L
for i in range(0, n):
	lcm = lcm * a[i] / gcd(lcm, a[i])
sum = 0L
for i in range(0, n):
	sum = sum + (lcm-1L) % a[i]
print sum

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def solution(a):
    #todo: check if a is valid
    return sum(a) - len(a)

def main():
    n = int(raw_input().strip())
    a = [int(i) for i in raw_input().strip().split()]
    print solution(a)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# encoding: utf-8
N = int(input())
a = list(map(int, input().split()))

# max f(m) when m = (common multiple of a_1, ... ,a_N) - 1
print(sum(a) - N)

Submission status: Accepted

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

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

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

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

res = 0

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

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

_A = list(map(lambda x: x - 1, A))

print(sum(_A))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
n = input()
ret = 0
for a in input().split(" "):
    a = int(a)
    ret += a-1

print(ret)

Submission status: Accepted

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

Submission status: Accepted

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

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:
def GCD(a, b):
    if(a % b == 0):
        return(b)
    return(GCD(b, a % b))

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

gcd = a[0]
for i in range(1, len(a)):
    if(gcd < a[i]):
        ret = GCD(a[i], gcd)
    else:
        ret = GCD(gcd, a[i])
    gcd = gcd * a[i] // ret
ans = 0
for i in range(len(a)):
    ans += (gcd - 1) % a[i]
print(ans)

Submission status: Accepted

Solution code:
#abc103c

n=int(raw_input())
a=map(int,raw_input().split())
res=0
for i in xrange(n):
 res+=a[i]-1
print res

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

m = (prod - 1)

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

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)


def main():
    n = I()
    a = LI()
    m = 0
    for c in a:
        m += c - 1
    return m


print(main())

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Mon Aug  6 17:15:00 2018

@author: Yuki
"""

N = int(input())

A = list(input().split())
A = [int(i) for i in A]
#
#def get_f_value(m, A):
#    mod_list = [m%i for i in A]
#    return sum(mod_list)
#
#def gcd(a, b):
#	while b:
#		a, b = b, a % b
#	return a
#def lcm(a, b):
#	return a * b // gcd (a, b)
#
#def get_lcm_from_list(A):
#    lcm_list = [lcm(A[i], A[i+1]) for i in range(len(A)-1)]
#    return max(lcm_list)
#
#lcm_value = get_lcm_from_list(A)
#res = []
#for m in range(lcm_value):
#    res.append(get_f_value(m, A))
#print(max(res))

print(sum(A) - N)

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(3100)

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

def lcm(l):
    def aux(l, i):
        if i == len(l) - 1:
            return l[-1]
        rest = aux(l, i+1)
        return l[i] * rest // gcd(l[i], rest)
    return aux(l, 0)

def modsum(a):
    k = lcm(a) - 1
    return sum(map(lambda x: k % x, a))

if __name__ == '__main__':
    _ = input()
    a = list(map(int, input().split()))
    print(modsum(a))

Submission status: Accepted

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

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

print(sum - n)

Submission status: Accepted

Solution code:
def main(N, a):
    m = getlcm(N, a) - 1
    f = 0
    for i in range(N):
        f += m % a[i]
    print(f)

def getlcm(N, a):
    l = 1
    for i in range(N):
        l = l * a[i] // gcd_(l, a[i])
    return l

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

if __name__ == '__main__':
    N = int(input())
    a = [int(i) for i in input().split()]

    main(N, a)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
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)

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

l1 = sys.stdin.readline()
N = int(l1.strip())
l2 = sys.stdin.readline()
l2 = l2.strip()
M = [int(x) for x in l2.split()]

X = lcm_list(M) - 1
Y = 0

for x in M:
  Y += X % x

print(Y)

Submission status: Accepted

Solution code:
N = input()
a = input()

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

m_max = sum(a) - len(a)
print(m_max)

Submission status: Accepted

Solution code:
number_int = input()
list_int = list(map(int,input().split()))

print(str(sum(list_int) - int(number_int)))

Submission status: Accepted

Solution code:
#coding: utf-8
if __name__ == "__main__":
    N = int(input())
    alist = [int(x)-1 for x in input().split(" ")]
    print(sum(alist))

Submission status: Accepted

Solution code:
# coding: utf-8

def gcd(n1, n2):
    if n1 < n2:
        n1, n2 = n2, n1

    while n1 % n2 != 0:
        rest = n1 % n2
        n1, n2 = n2, rest

    return n2

def lcm(n1, n2):
    return n1 * n2 // gcd(n1, n2)

def getM(alist):
    nLcm = lcm(alist[0], alist[1])
    for i in range(2, len(alist)):
        nLcm = lcm(nLcm, alist[i])
    
    return nLcm-1

def f(m, alist):
    t_sum = 0
    for ai in alist:
        t_sum +=  m % ai

    return t_sum
    
if __name__ == "__main__":
    N = int(input())
    alist = [int(x) for x in input().split(" ")]
    print(f(getM(alist), alist))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
li = input().rstrip().split()
le=[0]*N
for i in range(0,N):
    le[i]=int(li[i])

sum = 0
for i in range(0,N):
    sum = sum + le[i]-1

print(sum)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/python3

from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


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

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
input_lines = input().split()

for j in range(len(input_lines)):
    input_lines[j]=int(input_lines[j])

#m = max(input_lines)*2-1
p=0
for i in input_lines:
    p=p+i-1
    #print(p)
print(p)

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    t = input().split(" ")
    a = [int(i) for i in t]

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

main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#! python3

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

for i in range(len(a)):
	a[i]=a[i]-1
	s+=a[i]

print(s)

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 = [int(n) for n in input().split()]
print(sum(a)-N)

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:
# coding: utf-8
# Your code here!
str = input()
n = int(str)
str2 = input()
list = [int(y) for y in str2.split(" ")]
 
print(sum(list)-n)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import functools
import fractions

N = int(input())
numbers = list(map(int, input().split()))
answer = sum([n - 1 for n in numbers])

print(answer)

Submission status: Accepted

Solution code:
def main():
    """
    2 <=  N <= 10^3
    2 <= ai <= 10^5

    非負整数 m に対して
    f(m) = (m mod a1) + (m mod a2) + (m mod aN)
    f_max

    mの制約は問題文中には直接記述されていない
    """
    N = int(input())
    *A, = map(int, input().split())

    ans = editorial(N, A)
    print(ans)


def f(N, A):
    """
    直感: 最小公倍数,最大公約数
        最小公倍数のm ならすべてのaで割り切れる
        つまり最小公倍数-1 ならすべてのaについて m mod ai = ai - 1

    m=a_MAX-1, (m mod a_MAX) が最大
    ただし他のa=a_MAX-1 の場合、f(m)は小さくなってしまう
    aiに対して1 <= m <= a_Max-1 をすべて試す: 10^5 * 3 * 10^3 => TLE
    """
    try:
        # py3.5
        from math import gcd
    except:
        from fractions import gcd

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

    m1 = lcm(A[0], A[1])
    for a in A[2:]:
        m1 = lcm(m1, a)

    m = m1 - 1
    ans = sum(m % a for a in A)

    return ans


def editorial(N, A):
    """
    lcm を求めなくても、ai - 1 であることはわかるので
    lcm を計算しなくてよい
    """
    return sum(a - 1 for a in A)


def WA(N, A):
    ans = 0
    m_max = max(A) * 2 - 1
    for m in range(1, m_max):
        mods = [m % a for a in A]
        tmp = sum(mods)
        print(*(mods + [tmp]), sep="\t")
        ans = max(ans, tmp)

    return ans


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():
    count = int(input())
    num_str = input().split()
    num_list = []
    num_list = [int(s, 10) for s in num_str]
    sum = 0
    for i in range(count):
        sum += num_list[i]
    print(sum - count)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
_ = input()
a = list(map(int,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([(ai-1)%ai for ai in a]))

Submission status: Accepted

Solution code:
import sys
import math
import numpy as np
import itertools


# ひとつ入力
n = int(input())
# リストに入れる
a = [int(i) for i in input().split()] 
answer=0
for i in range(n):
    answer += (a[i]-1)

print(answer)

Submission status: Accepted

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

Submission status: Accepted

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

def f(m, a):
    return sum([m % i for i in a])

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

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

print(f(lcm -1, arr))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def getinputdata():

    array_result = []    
    array_result.append(input().split(" "))

    flg = True

    try:
        while flg:

            data = input()

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = True

            else:

                flg = False
    finally:

        return array_result

arr_data = getinputdata()

n=int(arr_data[0][0])

arr=[int(arr_data[1][x]) for x in range(n)]


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