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

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

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











# ??!~<<??11z<<<<<+(J+gQWHMMMHHHHUUUVVz<<<<1OOOOXWWkqHHHHHHHkqkqHHkqHHHHHHHkHHHUHHHHHHHHWWWWWWWWWWWWWWUUUVVOOOOOOOOOOOOOOOOOwZXVwVZZZOOOOOOz<<<<<<<<<<<<
#  ......-_(JgXVB9UUZyyyyWWyVVyWXzvrI<::++z+1zOXfWkkkkkkkkkkkkkkkkkbkbbbbbppHo(dppppfffffVVVVyyyyyyyZZuvrrttttttv1llllllllztrZ!_?rttttttll?;;;;;;::~~~~~
# yUUUUUUWVVk&++?zOwXuuuvvXyVyZuuzZv~~~``~!  (OXkkqkkkkkkkkkkkkkkkkkkkbbbbbbbWbppppf?77T4pVfVVVVyyyyZuvrrttttttt>(ttttlltrrvZ:_-Jrrrtttllz>;;;;;;::~~~~~
# .........-?74WyXx<zOOwrrzuuuuzzZz<_(+<     __zTWkqqqkkqkkqkkkkkkkkkkkkbbbbbbbbpppR....JffffVVVVyyZuzvrrrrrrrrrrrtttttrvvzzw+Owvrrrrrtlz>>>>>>>;:~:~~_(
# VVV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ZyWppppbkbkkkHHWyyVWHVVVWHWffWWVY>_~.........``.`..`.`.`.....` ?7CwZvXXx-.?WyyyyyVVVyyyyyyyyyXZZuXZtrrrrrrrtll==zzvzzzzzvvr
# _______._  ..~___` (VW}.VWZXWfpppbbbkkHHyyyVWHHVVVWHWWXY>:~~~~........`.......``.`````````.`..-?CXZkz+.?WyVVVVVVVyyyyyyWsdZXrtrvzzzzvttlllzwzzzuzzzzzv
# yVVVyVyyC .yyWY``.dVVV}.VVVfpppppbpbWHyyyyWWHVVVVWHKY<::::::~~~~...-----(((((J(-(......`.`..`.._..?4XAz<.?WfffVVVVVyyyyyZZXrrrzzuuzzrrtttOwuuuuuuuzzzz
# OVyVyVVf (VWY``.dVyyVW!.fWfpfppppbWHWyyyyWHHVVVVVH3_::::::::((J&QWHHHWHUkyZZZyyyXXWkXXUUX&J-........_Tkz+i.CWpffVVyVVyyyZuvvzuuuuuzzvrrrvzuuuuuuuuuzzv
#  OVyVVf`-WY``.uWVyVVV$ dyffpfppWpWHyyyyVWHHVVfVfWC::::::(+dHHHffVffffWNkWyWZZZZZZwXXkwrwvZWkZUG--~~.~_14yz<.,WpWffVVVVyZ0zzuuuZuuuzzzvvzuuZuuuuuuuuuzz
# +.UyyS!.Y!`.JyVVyVyy0~.VyWffppfpHWyyyyyWHMVVfffpHI::++gHHfWHpfffVfWfVXHkXkWXZXXOOuZOXkOlzrrXWzvwZUa,~._1vk1?- 7WWffVVyWXuuuZZZZZuuuuzuuuZZZZZZZZuuuuuu
# _!.WX!,!`.JVyWyVyVy0!.XVVVVffpWHXyyyyVWgMVffffWWUijdMHppppWpVVVWZWWXXZHHkXWwXZOz=OI?wuO<;1rtZWzZOwrZW&-_1?kl(-`(WpfVyyuuZZZyZZZZZXZuXXXXyyZZZZZZuuuuuu
# .``(:``.JyyyVyVyVWf~.XyyyVVVfWHyZyyyyWHHVVffWWpHdHHppffppVHfSyySuXWXkXdgHkWkwXz+?zXzjuXc;;OZzZRrvzrrrZUn-<zw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ZHkWkXZuuXXkXkO===??+__ ?<+<<;;;;<
# ???OrrrvvzzzuzuuuuuXXqHVWNfVfVypH@HMpppppbpWXH@@MkbkHMNHMNNMN#K79NZ.` ~._T&_?TWHkbbHMMHbWWdMMMMMTM#N,_XfWkVVWSyWHyyyyXHHWkZZZXkUkzzrwOzz1<<<-.`_<+:___
# <>??1zOrrvzwZ7?TuXWXqmHVWMffffVfWHM@WbppbbbWXWH@MkkWMMNMMMMNMMNp__==``   ``.?<.__<79WWHHOMNfMNNMN/(WMNJHWHWfWdVWHyyyyZXHq$<wZZWZOXtzztltOOO&+_~~.-_<_`
# ;<1=zttrOIz____..7WHmgHVfMpWfpfpWMMMHbpbWHbbppMHMkHMMMMNWMMNMMMN.` `        `   ``.JHY77HMMMMMMMM@ _7HHJNWHWSXVWHWVyyXXXHqWkyZXSrOwOtzvzlll1+?1&-<<__-
# ++1=ltrrrvwzz<__._(UmgHVVMfWXpppbMM@NpppbHWbppWHNHHMH1M#MMqMMHHM{     `    `  `  ?"!   .NBW9TGdHMN. _dHv?HWHdfffWHWWVyWXWHqqkyXdkrrZwtlO++1z1=?<<+i+1(
# ztltttrrrrrvvOx<___~ZgHVVMpfXfpppM@@MWbbbWNbkbbM@BM@!.##"4C?HKjM{ ` `  ` ` `  ``  `  ``.{`.Ngv9TH#`  .g]__WdMWfffHWHVVVVkUWHqkXvWkwrrXOl==1+<?<<<<<77?
# JltttttttrrOdHXHgQWHgHHVV@WpXpfppH@@@HbbbbHHbkHHPJ#_  W` dBB6jWY `   `    `     -       ?Hm+-JadgF ` JH' _d@NMkpfHkWkfVVfWy4WqHywWWwvwZXz==z1:` `  ..(
# llllllltOOwWXHmmmmmmHMfff@HpZppppWM@@NHbkkW@HkkbHJW+` .WkmJvY"=!`` `  ` `  `` __< ` `  ```` _?TC=``.7!` .(HW@HHkfWHWHkfffVfWsVWHkXkOXwrOtZwv!.-_-_~(dz
# lllltlzlOdWWqHHmmmHMgHfffMHpZpfpppM@@MHbWbkH@HkkbH/_7  .7_...````````  `     ` _( `  ` ``````.``````   .`jHWHM@MkfWWHgkfpfWHkWAvWWWOtlOXwwv<(:(<((jwZX
# zllzlOGdWWkH@HmHHgmHgHffWMHpyfpfppHMM>HHkkHHH@HkkWH,`...........``````  `` `    `  `  `````` ....... .``.HpWH@H@MHWHHHHHfppfWHHkkzUktltlzI+&z+<?CdSXXX
# lzugkHbHHWHHH9AHHHVWg@ffWMHpZpppppWHD:?HpbbHkHMNbbHH,._....._.._.```` `  ` `  `   ` ` ` ``` _`-.........WpWH@H@@HMNHHWH@HWfpfffWHHkJSZzlll==zTXy+-?XWH
# HkWHHWkHBUOltdHVVVWggMfpM@HpXpfppfpMb~vWbbbkHbHH@HkbH&_.....~....````` `  `  `  `   `  ``````..`_..-_..XWHH@@@H@@H@NqpWH@MHpfpWWXWHHkXyOll==z=uXWkkXZW
# WWU90llllltzdVVyVVHgM#fWMHHfXppppWWHN_>XkbbpWNpHHMVbkkh-.......`.```` ` `  `  `  ` ` ` `````````.`....WWDdM@H@@g@H@NMkpM@@HMkpffWXZWgHXkttltuWqHqHHHWX
# _?TwzzlttldWXyVyVWHNMffWMHHWXffppWXWMp~dHbbppWHbHHb~7WkHe-` `````````  ` ` ` ` ` `    `   ````````` (X=J<H@@@@Mg@M@MMMWW@@@@@MkWfWXvUHHkWwgmmHgHHWUIzz
# ::::<zyOdWXyyVyVWgHHNfWHMHHRWppppWXWMMxJWHppppWHpHH_`._74Wm..``````  ` `  ` ``  ` ``     `  ` `` `.7!`.%(M@@@@HHHWMMH@NW@HmH@MHHkpkXzvWHHHHHBBUWS&O==l
# ::::;:(7kyyyVVVWgHMMHWMM@gpSppfVVSdpMHMgWMWpppfWNbWR.` _ `  _?``` ` ` ` ` `  .... ` `` `  `  `  `  `  Z(@Hg@g@qq#X@@@@MH@mmg@MMgHHkkz1zWHHHWWXuuuXww0y
# :;;:;;:;<4WyVVWkHMM#XWMMggWdWyfXX0dpHHMMWHNpppWWHMHH.?i-`` ``    `  `  ` `.Z1;;<1Zl   ` `  `  `   ` `(ggggqmgHkWSHHHgg@gHqqqHHSXuvwHWyOwWHgKWkXZuuuuuw
# XA&+<;;;;<vWyWHMMkY1WMMMHHSX0XWzwIdpHMHMHHHNpppWXWMHb ` ?<.`` ` `  ` `   (>;;;;;;;d:  `  `  `  `` ` .HgHmHHqqpbKdWmqmmgHHHHWVVyXkmHSdWWyXyHNz=zVWkZXkV
# XwZXWHex>+>?HgMMH[ .dMMMgHXSzXWXwIdpWM@MHWHMNppfWZWMH[  ` (- ` ` `  ` ` `u+;;;;:;+2 `  ` ` ` `  _` .HqqqHpkHHfKwSXkkqqHHWffWWWHHqqHOlzWfVyVHZ====1f'``
# Zy0XXWWVWez=zHHHM#AdMHHgHHdXZWWkwIdfH@MMNW@NWHfVyXOWMH;  ` ..  `  `  ` `  ?<+<<<?``  `  ` ` ` ``` .HHqkHfWWYT77!???7"TWWkWHbHMmkkq6lllzWWVyWb=z=z^``
# UOwyWXXXVWMmyzW@MVVW@@MggSfZWWWkXIXfMMMMNpHNpWHfkwOwXWHx.   _`  ` ` ` ` `` `` .`   `  `   `  `  .dkWHWHV= .!`      ` _._(zTYY9YUW0yuzzlzWyyWH?12``  `
# XyWWSwVyWWgmNWHWHVWM@@MHHXfyVWHWXlXfMMHpHfWMpHMNWkwOwZWNe-.`` ` `  ` `  `  `` _`` `` ` ` `  ``.dHWWpWV! .!`      ` .-~~        `  `` _Tx=WyWWz^``  `.(
# WHSwXVfWgggH@@HHXWHM@HMHXHVVVWHykzVWHpppHWfH@@@HMHfkXZAXWmV&-. ` ``  ` `  `      `  ` ` ``` .dmHHkpK!  .`    `   ``          `          ?wHWY``  ` (::
# WXXVVWHgggH@MgHHWWHbWkHSHHVVyWHy0dVWHbbpWkWWHMM@@@NkffWWwWWHeVu.. ` `  ` `  ` ` ` ` ` `` .JgHHmqqY:   .`                  `   .._________~(^   ` .(;;<
# XWyWHgmgH@MggHMHyHNkbpHXmHyVyHHVkdVWWHkMHNVWM@@@MH@MNWppWkXHHHWxvO+. ``  ` ` ` ` ` ```.(HMHHMNH@<`    _`                ` ..JdWHHHHHHmgJ_J`  ` _<1<<+1
# yWWHHHHMHggg@@MyWH@@M#dmgHVyyHNySXyWM@MMMMXVM@HH@@@@@MNkpfpffpVWHmx+7z-.``` ` `` ` .J=<J@@@@MHD_   ` .           `  ` ` .dWZyWyWQkWkWW@H#`` `  _:<O=uS
# WggmNJMgggH@@HMyX@@@MdMMmHWyyWNyyyyH@@@@HMKVHH@M@@@@@$cdNkppppWhJWWW+;:<71-. `  .JC<:::(MMMHH@_    ` _`  `  `     `   (XZZyyWkY>~_`__:+?%``  `  _:<zSz
# ggggggggg@@HM@@VXMHMX@@NWmHyyWHWyyyWgg@@HHNWWMM@@@@@@g@HH@MkfpppHs+TkW+<:::(??7C(::::::<zdkHM~       :  `      `    (dXyyyWWY~ `  .(<! ._ ` ` `  _:<Oy
# mggggmgg@MM@@@HHWM#X@@@@HHqkyWHHyZyWHHHkHHMHWMg@@Hgg@g@@@@@MMkpHkWh<?UWe<::::::::::::::(dkkH%     ` ._   .    ` ` _(HfpfWW9~    .(!`  ` 1``  `    _::O
# ggmmgmHM@@@HH#WkXBd@@gHHHXqHkXqNyyyXHWHMgggMWWHHqggHg@ggg@HMMMNkWHWW<:?Wn:::::::~::~::(dbkHF       `._  .~    ` .(XHkbbW#>` ``./!   `  ` l ` `     ~::
# gmmgmH@@@HHY3jHMSHHqqkHHHHXHHkWHHyZXSdHHggg@NyHWgggHMggggHM@MM8VWWHHW_:?W<::~::~::::~_dpkbK``  `   ` ;` ~~     _JdHWkHH@:` ` .``  `` `  ` ?+. ....._::
# mmmHH@@@M9>_+MHWHWHHHHHkkHqXHqXqHkyWWggggHHHHNXMHHMgmgggMH@M9Izd?WWMHh:~Jr:::::::~~``JWpWW\          < .~~ `  (+1WHqHHD<``      `    `` ` `j?&``.`.-<<
# mqH@@HHY<<;jMHXkHHHHmHYY1>>vkWHWkHkyWHggg@gHkWMkMHgHggBMMMMz<<<J<?HWMH[~J<:::~::~`` (HHppP  `     ` `(__::_ `.+1j@@@H#:~`` `` `  ` `  ` `` .I(h.` ..(<
# WHMHW6<<<>jMkqkHgHH9z>>>>??<?WUHkHNkZWHHMgHkkmgHHHVY3<(@@MD<;<<>::?HWMN(>:::::~`  ,jHWppW>    `      .<_:~_` <<+d@@@M$:_  `  ` `` ` `  `  ``.%.o ` .-j
# HMW6;;;><jWHkkHHH9<>1z<???????ZwWqkHkXMMmHbbHBY>_?4n_~W@@MI;:::::::JKWN<::::~`` (~.WVVVWP`    `  `   `<:~:~_(::<d@@@M<::_-.  `      ``  ` `.>`._I.` _d
# NV<;;;;;;dmkH$dH$<<>>>+>>??????+HyWkHkXHmHY>~~~~~:~_?4M@@N<<::::::::HfM<::~` ` /  dVVWVK`    `   _    ._::::_:~(d@H@Hz:::::_.` `  ` ` `` `.2 .~(+v+..H
# $(::;;;;jHHH3;WH;>>>>>>><<~~~~<(HHNkWHHkH_~~~~~~~~~~__HHHHo+<((((_(:dX#~` ` ` (` (WVVWX!  `       __~..<~~::~::(jH@@HR<:::::__ `  `  `  `./ ._(+zwwyWK
# (::::;;:dHH$<;?W+>;::::~~:__- .HHHqHHkUWHk&__.....````dHpbh_   ` ```-H] `  ` _ .JffVWX!             _~__1:~~:~:~(W@MHNz+<:::::__.```` `  c`._<1zwXX9=<
# ::::::<<dHX;;;;;1+;;;;;:_((:~(HHkHHpkH6YOwVWa,..``````,NpbWh:__...   H!  ``-_`.XfffWf`  `     `   ` ` _<(<(~:~~::?M@@MN=1i:::::::___.  ./ .(+zOwXHJ(((
# ::::::::WHP:;;;;;;;;;;;>>>><jHWHWXWWk$(_~._<77T1.```   wWppph<~____ .`` ```..WWWfVX^  `            `   ___<+_<_~:~?H@@@Nzz1+::::::::~_(2 _(+zOwZyWk<?7
# :~::::::dHk::;;:;;;;;;;;>>;jWWUV1KWbH~_<....`````       4WppWHx.` ` !``..(WHpfpWK= `       `           `.~_<<1++~:~<THH@Mmzzz<:::::::<2__(+zwwZyyVWHe+
# ~:~~:::::4Xc::::;:;;:;;;;+dWXX6>dWWHR~~(-..````        ` ?WppWpWHkAAQWHHHpfppWY^              `        `..~~~~(?T&~~~<TMMMMNgd&<<<;<<v ~(+zwXZyyVyVfHH

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from statistics import mean, median,variance,stdev
import numpy as np
import sys
import math
import fractions
import itertools
import copy
import collections
from operator import itemgetter
#以下てんぷら
def j(q):
    if q==1: print("You can win")
    else:print("You will lose")
    exit(0)


def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")

def ip():
    return int(input())
def printrow(a):
    for i in range(len(a)):
        print(a[i])
def combinations(n,r):
    if n<r:return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def permutations(n,r):
    if n<r:return 0
    return math.factorial(n) // math.factorial(n - r)
n = ip()                                     #入力整数1つ
#a,b,c= (int(i) for i in input().split())       #入力整数横2つ以上
a = [int(i) for i in input().split()]        #入力整数配列
## a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列
#k = ip()                      #入力セット(整数改行あり)(1/2)
#a=[ip() for i in range(n)]    #入力セット(整数改行あり)(2/2)
#jの変数はしようできないので注意
#全足しにsum変数使用はsum関数使用できないので注意
#こっから本文
s = a[0]
for i in range(1,n):
    s = s * a[i] // fractions.gcd(a[i], s)
b = 0
s-=1
for i in range(n):
    b+=s%a[i]
print(b)

Submission status: Accepted

Solution code:
#ABC 103
import functools
import operator

N=int(input())
A = [int(j) for j in input().split()]
result = functools.reduce(operator.mul, A)
ans = 0
for a in A:
    ans+=(result-1)%a
print(ans)

Submission status: Accepted

Solution code:
#ABC 103
N=int(input())
A = [int(j) for j in input().split()]
print(sum(A)-len(A))

Submission status: Accepted

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

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:
from sys import stdin

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

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

print(ans)

Submission status: Accepted

Solution code:
from functools import*
from fractions import*
n,*a=map(int,open(0).read().split())
def ggcd(b,c):
    return b*c//gcd(b,c)

d=reduce(ggcd,a)-1
ans=0
for i in a:
    ans+=d%i
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0
for l in list:
    ans += l-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)

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

N = int(input())
a = [int(x) for x in input().split()]
x = lcm(*a)-1
ans = 0
for i in a:
    ans+=x%i

print(ans)

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

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

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

print(sum)

Submission status: Accepted

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

print(sum(As)-N)

Submission status: Accepted

Solution code:
from functools import reduce

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

m=reduce(lambda x, y: x * y, a)-1
f=sum(map(lambda x: m % x, a))

print(f)

Submission status: Accepted

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

import itertools
from collections import Counter
import bisect

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
from fractions import gcd
N = int(input())
A = list(map(int, input().split()))
key = 1


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


for a in A:
    key = lcm(key, a)
key -= 1
ans = 0
for a in A:
    ans += key % a
print(ans)

Submission status: Accepted

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

print(sum(a) - N)

Submission status: Accepted

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

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

Submission status: Accepted

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

for i in range(N):
  ans += (a_all -1) % a[i]
print(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 = [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())
a_list = list(map(int, input().split()))
print(sum(a_list)-len(a_list))

Submission status: Accepted

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

for i in a:
    ans += i-1

print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
import itertools
import collections
import functools
import math
from queue import Queue
INF = float("inf")


def solve(N: int, a: "List[int]"):
    print(sum([v-1 for v in 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 = [int(i) for i in 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)

s = a_list[0]
for i in range(1,N):
    s = lcm(s, a_list[i])

def f(m):
    c = 0
    for a in a_list:
        c += m % a
    return c
print(f(s-1))

Submission status: Accepted

Solution code:
from functools import reduce
from operator import mul
from sys import stdin
n = int(stdin.readline().rstrip())
al = [int(_) for _ in stdin.readline().rstrip().split()]
m = reduce(mul, al)-1
print(sum(m%a for a in al))

Submission status: Accepted

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

Submission status: Accepted

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

print(t)

Submission status: Accepted

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

f = 0
for i in range(N):
    f += a[i]

print(f-N)

Submission status: Accepted

Solution code:
N = int(input())
L = list(map(int,input().split()))
L.sort()
def gcd(x,y):
  while y != 0:
    k = x
    x = y
    y = k%y
  return  x
LCM = L[0]
for i in range(1,N):
  A = max(L[i],LCM)
  B = min(L[i],LCM)
  cur = gcd(A,B)
  if cur == 1:
    LCM *= L[i]
  else:
    LCM = LCM*L[i]//cur
LCM -= 1
ans = 0
for i in range(N):
  ans += LCM%L[i]
print(ans)

Submission status: Accepted

Solution code:
from functools import reduce


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


def _lcm(a, b):
    return (a * b) // _gcd(a, b)


def lcm(*n):
    return reduce(_lcm, n)


def f(_a):
    num = lcm(*_a)
    result = 0
    for i in _a:
        result += (num - 1) % i
    return result


N = int(input())
A = list(map(int, input().split()))
print(f(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:
# -*- coding: utf-8 -*-
n = int(input())
a = list(map(int,input().split()))

m = a[0]

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

def lcm(a, b):
    "gcd関数を必要とする"
    return (a * b) // gcd(a,b)

for i in range(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())
l=list(map(int,input().split()))
s=0
for i in l:
  s+=i-1
print(s)

Submission status: Accepted

Solution code:
import time
import sys
import math
import fractions
from functools import reduce
from collections import Counter
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]  # LIST INT
def LF(): return [float(x) for x in sys.stdin.readline().split()]  # LIST FLOAT
def LS(): return sys.stdin.readline().split()  # LIST STRING
def MI(): return map(int, sys.stdin.readline().split())  # MAP INT
def II(): return int(sys.stdin.readline())  # INPUT INT
def IS(): return input()  # INPUT STRING
def P(x): return print(x)
def C(x): return Counter(x)
def GCD_LIST(numbers):  # greatest common divisor
    return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers):  # least common multiple
    return reduce(LCM, numbers)
def LCM(m, n):
    return (m * n // fractions.gcd(m, n))


N = II()
a = LI()
# aのすべての数の最小公倍数-1をaの各要素で割った剰余の和
lcm = LCM_LIST(a)
print(sum([(lcm - 1) % i for i in a]))

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
N = int(input())
ans = 0
for a in map(int, input().split()):
    ans += a
print(ans - N)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

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

Submission status: Accepted

Solution code:
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque, OrderedDict
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from math import ceil, floor
from sys import setrecursionlimit

import heapq
import itertools
import operator


inf = float('inf')


# globals
N = 0
A = []


def set_inputs():
    global N, A
    N = get_int()
    A = get_li()
    return


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


def main():
    setrecursionlimit(100000)
    set_inputs()
    if N == 1:
        print(A[0] - 1)
        return
    x = reduce(lcm, A) - 1
    print(sum(x % i for i in A))
    return


def get_int():
    return int(input())


def get_float():
    return float(input())


def get_str():
    return input().strip()


def get_li():
    return [int(i) for i in input().split()]


def get_lf():
    return [float(f) for f in input().split()]


def get_lc():
    return list(input().strip())


def get_data(n, types):
    if len(types) == 1:
        return [types[0](input()) for _ in range(n)]
    return zip(*(
        [t(x) for t, x in zip(types, input().split())]
        for _ in range(n)
    ))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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()
print(sum(list(map(lambda x: x - 1,map(int,input().split())))))

Submission status: Accepted

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

Submission status: Accepted

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

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())
m = list(map(int, input().split()))
print(sum([x-1 for x in m]))

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=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:
from sys import stdin
import numpy as np

N = int(stdin.readline().rstrip().split()[0])
A = [int(x) for x in stdin.readline().rstrip().split()]

print(sum(A)-len(A))

Submission status: Accepted

Solution code:
def gcd(a,b):
    while a%b!=0:
        a,b=b,a%b
    return b
def main(a,b):
    return (a*b)//gcd(a,b)
N=int(input())
A=list(map(int,input().split()))
res=A[0]
for i in range(1,N):
    res=main(res,A[i])
res-=1
ans=0
for a in A:
    ans+=res%a
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
m=1
sum = 0
def gcd(a, b):
 if a < b:
    a, b = b, a
 if b == 0:
    return a
 c = a % b
 return gcd(b, c)
def lcm(a,b):
    return int(a*b/gcd(a,b))
for i in range(n):
    m = m *a[i]
for i in range(n):
        sum += (m-1) % a[i]

print(sum)

Submission status: Accepted

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

Submission status: Accepted

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

m=lcm(a)-1
ans=0
for x in a:
    ans+=m%x
print(ans)

Submission status: Accepted

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

m = sum(a)-n

print(m)

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

print(sum(a)-N)

Submission status: Accepted

Solution code:
# def gcd(x, y):
#     if y == 0:
#         return x
#     else:
#         return gcd(y,x%y)
#
#
# def lcm(c, d):
#     return c * d // gcd(max(c, d), min(c, d))


N = int(input())
a = list(map(int,input().split()))
# A = a[0]
# for i in range(1,N-1):
#     A = lcm(A, a[i])
print(sum(a)-len(a))

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(item) for item in input().split()]

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
from functools import reduce
from fractions import gcd
# ----------------------------------------------------------------
# Use Solve Function

def solve(lines):
    N = int(lines.pop(0))
    A = list(map(int, lines.pop(0).split(' ')))
    lcd = reduce(lambda i,j: i*j//gcd(i,j), A, 1)
    m = lcd - 1
    A = [ m % i for i in A ]
    print(sum(A))

lines = [x.strip() for x in sys.stdin.readlines()]

#
# solve !!
#
solve(lines)

Submission status: Accepted

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

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

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//gcd(a,b)*b

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(sum)

Submission status: Accepted

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

print(sum(al)-n)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
ANs = list(map(int,input().split()))
 
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
 
def lcm_base(x, y):
	return (x * y) // gcd(x, y)
	
lcmNum = ANs[0]
for a in ANs[1:]:
	lcmNum = lcm_base(lcmNum,a)
	
#print(lcmNum)
 
f = 0
for a in ANs:
	f += (lcmNum-1)%a
print(f)

Submission status: Accepted

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

m_1 = 0
for a in ANs:
	m_1 += a-1
	
print(m_1)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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