Problem:

ギャグ (Gag)

Segtree 君は $N$ 個の「ギャグ」を持っていて、それぞれに「できばえ」 $V_i$ という値が定まっています。

Segtree 君は自由な順番で全てのギャグを公開することにしました。

ここで、 $i$ 番目のギャグを $j$ 番目に公開した時に得られる「うれしさ」は $V_i - j$ と表されます。

Segtree 君が得られる「うれしさ」の和の最大値を求めてください。

入力

入力は以下の形式で標準入力から与えられる。

$N$
$V_1$ $V_2$ $\ldots$ $V_N$

出力

「うれしさ」の和の最大値を出力してください。ただし、値が 32bit 整数に収まるとは限りません。

最後には改行を入れること。

制約

    
$1 \leq N \leq 10^5$

    
$1 \leq V_i \leq 10^5$

    
入力は全て整数である。

入力例1

1
59549    

出力例1

59548

入力例2

5
2 1 8 5 7     

出力例2

8



Sample input:
1
59549


Sample output:
59548

Submission status: Accepted

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

Submission status: Accepted

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

print(sum(V) - (N * (N + 1) // 2))

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int, input().split()))
max = sum(v)
for i in range(1, n+1):
    max -= i
print(max)

Submission status: Accepted

Solution code:
n = int(input())
print(sum(list(map(int,input().split()))) - n*(n+1)//2)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from itertools import *
from bisect import *
from math import *
from collections import *
from heapq import *
from random import *
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
def MF(): return map(float, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LF(): return list(map(float, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
dij = [(1, 0), (0, 1), (-1, 0), (0, -1)]

def main():
    n=II()
    aa=LI()
    print(sum(aa)-n*(n+1)//2)

main()

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int,input().split()))
print(sum(v)-n*(n+1)//2)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
ans = 0
print(sum(A)-(N*(N+1))//2)

Submission status: Accepted

Solution code:
def num():
    return int(input())
def nums():
    return list(map(int,input().split()))
"""
A,B = nums()
P,Q,R = nums()

first_distance = P * B
pre_runned = (B - A) * Q
time = B + (first_distance - pre_runned) / (R + Q)
print(time)
"""
"""
N = num()
randoms = nums()
ans = 0
for i in range(N):
    today = randoms[i]
    if i == 0:
        continue
    if today > randoms[i-1]:
        ans += 1
print(ans)
"""
"""
N = num()
members = []
for i in range(N):
    members.append(input())

ans = members.count("E869120")
print(ans)
"""

N = num()
V = nums()
V.sort(reverse=True)
ans = 0
for i in range(N):
    Vi = V[i]
    ans += (Vi - i -1)
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
print(sum(a)-n*(n+1)//2)

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int,input().split()))
count = 0
ans = 0
s = -1
while count != n:
    ans -= s
    s -= 1
    count += 1
print(sum(v)-ans)

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int, input().split()))
print(sum(a)-n*(n+1)//2)

Submission status: Accepted

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

print(sum(V) - N * (N + 1) // 2)

Submission status: Accepted

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

N=int(input())
V=sum(map(int,input().split()))
print(V-N*(N+1)//2)

Submission status: Accepted

Solution code:
n=int(input())
v=list(map(int,input().split()))
print(sum(v)-(n*(n+1)//2))