CodeEff/ECCO huggingface dataset:
# Original solution
N=int(eval(input()))
P=[]
for i in range(N-1):
  P.append(i+2)
P.append(1)
ans=0
for i in range(N):
  ans+=(i+1)%P[i]
print(ans)

# Optimized solution
N=int(eval(input()))
print((N*(N-1)//2))
# Original solution
N=int(eval(input()))

ans=0
for i in range(1,N):
  ans+=i

print(ans)

# Optimized solution
N=int(eval(input()))

print(((N*(N-1))//2))
# Original solution
n = int(eval(input()))

ans = [i for i in range(0, n)]
print((sum(ans)))

# Optimized solution
n = int(eval(input()))

ans = (n-1)*n // 2

print(ans)
# Original solution
N = int(eval(input()))
sum = 0
for i in range(1, N):
    sum += i
if N == 1:
    print((0))
else:
    print(sum)

# Optimized solution
N = int(eval(input()))
if N == 1:
    print((0))
else:
    print((N*(N-1)//2))
# Original solution
n = int(eval(input()))

ans = 0

for i in range(1,n):
    ans += i
    
print(ans)

# Optimized solution
n = int(eval(input()))

print(((n-1)*n // 2))
# Original solution
n = int(eval(input()))
print((n * (n - 1) // 2))



# Optimized solution
N = int(eval(input()))
print((N * (N - 1) // 2))
# Original solution
N = int(eval(input()))
ans = 0
for i in range(1,N):
    ans += i
print(ans)

# Optimized solution
N = int(eval(input()))
if N % 2 == 1:
    print((N * (N//2)))
else:
    print((N * (N//2-1) + (N//2)))
# Original solution
N = int(eval(input()))
print((sum([i for i in range(N)])))

# Optimized solution
N = int(eval(input()))
print(((N-1)*N//2))
# Original solution
N = int(eval(input()))
ans = 0
for i in range(1,N ):
	ans += i
print(ans)

# Optimized solution
N = int(eval(input()))
ans = (N * (N - 1)) // 2
print((int(ans)))
# Original solution
N = int(eval(input()))
print((sum(range(N))))

# Optimized solution
N = int(eval(input()))
print(((N*(N-1))//2))
# Original solution
n = int(eval(input()))
m = 0


for i in range(n):
    t = i + 1
    if t == n:
        m += 0
    else:
        m += t % (t + 1)


print(m)


# Optimized solution
n = int(eval(input()))

m = n * (n - 1) // 2

print(m)
# Original solution
print((sum(range(1,int(eval(input()))))))

# Optimized solution
n=int(eval(input()))
n-=1
print((n*(n+1)//2))
# Original solution
n = int(eval(input()))
r = 0
for i in range(1, n):
  r += i
print(r)

# Optimized solution
n = int(eval(input()))
print((n * (n - 1) // 2))
# Original solution
n=int(eval(input()))
if n==1:
    print((0))
    exit()

print((n*(n-1)//2))


# Optimized solution
n=int(eval(input()))
print((n*(n-1)//2))
# Original solution
print((sum(range(1, int(eval(input()))))))

# Optimized solution
n = int(eval(input()))
print((n*(n-1)//2))
# Original solution
n = int(eval(input()))

m=0
for i in range(n):
    m += i
print(m)


# Optimized solution
n = int(eval(input()))
m = int(((n-1)*n)//2)
print(m)
# Original solution
#n = int(input())
#L = list(map(int, input().split()))
import math
import sys
import fractions
N = int(sys.stdin.readline()[:-1])
sum = 0
for i in range(N):
    sum += i
print(sum)


# Optimized solution
#n = int(input())
#L = list(map(int, input().split()))
import math
import sys
import fractions
N = int(eval(input()))
print((N*(N-1)//2))
# Original solution
N = int(eval(input()))
ans = 0
for i in range(N):
  ans += i

print(ans)

# Optimized solution
N = int(eval(input()))

print((N*(N-1)//2))
# Original solution
a=int(eval(input()))
print((sum(range(1,a+1))-a))



# Optimized solution
a=int(eval(input()))
print((a*(a+1)//2-a))
# Original solution
N = int(eval(input()))

s = [i for i in range(N)]
print((sum(s)))

# Optimized solution
N = int(eval(input()))

print((N*(N-1)//2))
# Original solution
N=int(eval(input()))
print((sum(set(range(N)))))

# Optimized solution
N=int(eval(input()))
print((N*(N-1)//2))
# Original solution
#!/usr/bin/env python3
import sys


def solve(N: int):
    print((sum([i for i in range(1,N)])))

    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
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
    solve(N)

if __name__ == '__main__':
    main()


# Optimized solution
#!/usr/bin/env python3
import sys


def solve(N: int):
    print(((N-1)*(N)//2))

    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
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
    solve(N)

if __name__ == '__main__':
    main()
# Original solution
import sys
from heapq import heappop, heappush
from operator import itemgetter
from collections import deque, defaultdict, Counter
from bisect import bisect_left, bisect_right
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
MOD = 10**9 + 7
INF = float('inf')

def sol():
    N = int(eval(input()))

    ans = N * (N - 1) // 2

    print(ans)

sol()

# Optimized solution
N=int(eval(input()));print((N*(N-1)//2))
# Original solution
import sys

input = sys.stdin.readline

def main():
    ans = 0
    n = int(eval(input()))
    for i in range(1, n):
        ans += i%(i+1)
    print(ans)

if __name__ == '__main__':
    main()

# Optimized solution
import sys

input = sys.stdin.readline

def main():
    n = int(eval(input()))-1
    ans = (1+n)*(n//2)
    if n%2 != 0:
        ans += n//2+1
    print(ans)

if __name__ == '__main__':
    main()
# Original solution
n = int(eval(input()))

sum = 0

for i in range(n) :
    sum += i

print(sum)

# Optimized solution
n = int(eval(input()))

print((n * (n - 1) // 2))
# Original solution
print((sum(range(int(eval(input()))))))

# Optimized solution
n = int(eval(input()))
print((n * (n-1) // 2))
# Original solution
N = int(eval(input()))

a = [i for i in range(1, N+1)]
p = a.copy()
p = p[1:] + [p[0]]

print((sum([ai%pi for ai, pi in zip(a, p)])))


# Optimized solution
N = int(eval(input()))

print(((N-1) * N // 2))
# Original solution
num = int(eval(input()))

arr = [i for i in range(1,num+1)]

print((sum(arr[:-1])))

# Optimized solution
num = int(eval(input()))
     
print((int(num*(num-1)//2)))
# Original solution
n = int(eval(input()))
num = 0

for i in range(n):
    num = num + i

print(num)


# Optimized solution
n = int(eval(input()))

num = 0

num = n*(n-1)//2

print(num)
# Original solution
n = int(eval(input()))
m = 0
for i in range(n-1):
    m += (i+1)
print(m)


# Optimized solution
n = int(eval(input()))
m = (n-1)*n//2
print(m)
# Original solution
import sys
from collections import deque
import itertools
from collections import deque
sys.setrecursionlimit(10 ** 9)

# map(int, sys.stdin.read().split())


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


def main():
    N = int(eval(input()))
    print((int(N*(N-1)//2)))




if __name__ == "__main__":
    main()


# Optimized solution
import sys
from collections import deque
import itertools
from collections import deque
sys.setrecursionlimit(10 ** 9)

# map(int, sys.stdin.read().split())


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


def main():
    N = int(eval(input()))
    print((N*(N-1)//2))




if __name__ == "__main__":
    main()
# Original solution
n = int(eval(input()))
count = 0
for i in range(n):
    count += i
print(count)

# Optimized solution
n = int(eval(input()))
print((n*(n-1)//2))
# Original solution
n = int(eval(input()))
ans = 0
for i in range(n):
  ans += i
print(ans)

# Optimized solution
n = int(eval(input()))
ans = n*(n-1)//2
print(ans)
# Original solution
n = int(eval(input()))
result = 0
for i in range(1, n):
    result += i
print(result)

# Optimized solution
n = int(eval(input()))
print(((n*(n-1))//2))
# Original solution
N = int(eval(input()))
candi =int((N+1)/2*N -N)
if N%2 == 0:
    an = [ i for i in range(1,N+1)]
    an.reverse()
    nex_num = N
    count =0
    for i in an:
        if nex_num == i:
            nex_num = (i//2) + 1
            count += (i%nex_num) #next_numを割るところに使う
            nex_num = nex_num -1
        else:
            count += i #前の大きい数を使用する
else:
    an = [ i for i in range(1,N+1)]
    an.reverse()
    nex_num = N
    count =0
    for i in an:
        if nex_num == i:
            nex_num = (i+1)//2
            count += (i%nex_num) #next_numを割るところに使う
            nex_num = nex_num -1
        else:
            count += i #前の大きい数を使用する
if candi > count:
    print(candi)
else:
    print(count)

# Optimized solution
N = int(eval(input()))
print(((N-1)*N//2))
# Original solution
a=int(eval(input()))
b=[i for i in range(a)]
c=int(sum(b))
print(c)

# Optimized solution
a=int(eval(input()))
b=int(a*(a-1)//2)
print(b)
# Original solution
import sys
inputs = sys.stdin.readlines()

N = int(inputs[0])

s = 0
for i in range(1, N+1):
    s += i
print((s-N))

# Optimized solution
import sys
inputs = sys.stdin.readlines()

N = int(inputs[0])

print(((N-1)*N // 2))
# Original solution
n = int(eval(input()))
ans = 0
if n>1:
    for i in range(n):
        ans+=i
print(ans)

# Optimized solution
n = int(eval(input()))
ans = 0
if n>1:
    ans=((n-1)*n)//2 
        
print(ans)
# Original solution
N=int(eval(input()))
ans=0
for i in range(N):
  ans+=i
print(ans)

# Optimized solution
N = int(eval(input()))
if N == 1:
    print((0))
elif N == 2:
    print((1))
else:
    print(((N * (N-1)) // 2))
# Original solution
import sys

N = int(sys.stdin.readline())
print((sum(n + 1 for n in range(N - 1))))


# Optimized solution
import sys

N = int(sys.stdin.readline())
print((int((N - 1) * N // 2)))
# Original solution
N = int(eval(input()))
ans = 0
for i in range(N):
    ans += i

print(ans)


# Optimized solution
N = int(eval(input()))
print((N*(N-1)//2))
# Original solution
N = int(eval(input()))

res = 0
for i in range(N):
    res += i

print(res)


# Optimized solution
N = int(eval(input()))

res = (N - 1) * N // 2

print(res)
# Original solution
import os, sys, re, math

N = int(eval(input()))

print((sum([i for i in range(1, N)])))


# Optimized solution
import os, sys, re, math

N = int(eval(input()))

s = (1 + (N - 1)) * (N // 2)
if (N - 1) % 2 == 1:
    s -= N // 2

print(s)
# Original solution


import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
##############################

from collections import deque

N = int(eval(input()))
p = deque()
for i in range(N):
    p.append(i+1)

x = p.popleft()
p.append(x)

#p = [2,3,4,5,6,7,8,9,10,11,12,13,1]

#print(p)
count = 0
for i in range(N):
    count += (i+1) % p[i]

print(count)

# Optimized solution

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
##############################


N = int(eval(input()))

count = 0
for i in range(N):
    if i == (N-1):
        count += (i+1) % (1)
    else:
        count += (i+1) % (i+2)

print(count)
# Original solution
N = int(eval(input()))

# {1, 2, ..., N}
# {P1, P2, ..., Pn}　として {2, 3, ..., N, 1} を選べる

print((sum([i for i in range(N)])))
  



# Optimized solution
N = int(eval(input()))

# {1, 2, ..., N}
# {P1, P2, ..., Pn}　として {2, 3, ..., N, 1} を選べる

count = 0
for i in range(N):
  count += i
  
print(count)
# Original solution
N = int(eval(input()))

# {1, 2, ..., N}
# {P1, P2, ..., Pn}　として {2, 3, ..., N, 1} を選べる

count = 0
for i in range(N):
  count += i
  
print(count)

# Optimized solution
N = int(eval(input()))

# {1, 2, ..., N}
# {P1, P2, ..., Pn}　として {2, 3, ..., N, 1} を選べる

print(((N-1) * N // 2))
# Original solution
#!/usr/bin/env python3
import sys
# import math
# import numpy as np
# from functools import lru_cache

args = sys.argv
if len(args) == 2:
  from IPython import embed
  em = True
else:
  em = False

# sys.setrecursionlimit(10000)

#### input
N = int(eval(input()))
# a, b = map(int, input().split())
# a = list(map(int, input().split()))
# a = list(map(lambda x: int(x)*(-1), a))  # 各要素を-1倍


# n = int(input())
# t = [int(input()) for i in range(n)]
if em: sys.stdin = open('/dev/tty')

#### function
# @lru_cache(maxsize=10000)

#### process
I = [i for i in range(1, N+1)]
P = [i for i in range(2, N+1)]
P.append(1)

rems = [I[i] % P[i] for i in range(0, len(I))]
print((sum(rems)))
# if em: embed()

## heapsort, O(NlogN)
# import heapq
# heapq.heapify(A)
# min = heapq.heappop(A)
# heapq.heappush(A, new_element)


# Optimized solution
#!/usr/bin/env python3
import sys
# import math
# import numpy as np
# from functools import lru_cache

args = sys.argv
if len(args) == 2:
  from IPython import embed
  em = True
else:
  em = False

# sys.setrecursionlimit(10000)

#### input
N = int(eval(input()))
# a, b = map(int, input().split())
# a = list(map(int, input().split()))
# a = list(map(lambda x: int(x)*(-1), a))  # 各要素を-1倍


# n = int(input())
# t = [int(input()) for i in range(n)]
if em: sys.stdin = open('/dev/tty')

#### function
# @lru_cache(maxsize=10000)

#### process

if N % 2 == 0:
  tmp = int(N/2)
  print((int(tmp*(N-1))))
else:
  tmp = int((N-1)/2)
  print((int(tmp*N)))

# I = [i for i in range(1, N+1)]
# P = [i for i in range(2, N+1)]
# P.append(1)

# rems = [I[i] % P[i] for i in range(0, len(I))]
# print(sum(rems))

# if em: embed()

## heapsort, O(NlogN)
# import heapq
# heapq.heapify(A)
# min = heapq.heappop(A)
# heapq.heappush(A, new_element)
# Original solution
n=int(eval(input()))
s=0
for i in range(1,n):
    s+=i
print(s)

# Optimized solution
n=int(eval(input()))
print(((n-1)*n//2))
# Original solution
N = int(eval(input()))
c = [i for i in range(1, N)]
print((sum(c)))

# Optimized solution
N = int(eval(input()))
sum = 0
for i in range(1, N):
  sum += i

print(sum)
# Original solution
n = int(eval(input()))
sum = 0
for i in range(1, n):
    sum += i
print(sum)

# Optimized solution
n = int(eval(input()))
ans = int((n*(n-1))//2)
print(ans)
# Original solution
N=int(eval(input()))
ans=0
for i in range(N):
    ans+=i
print(ans)

# Optimized solution
N=int(eval(input()))
ans=(N-1)*N//2
print(ans)
# Original solution
n = int(eval(input()))
ans = 0
for i in range(n-1):
	ans += i+1
print(ans)

# Optimized solution
n = int(eval(input()))
print((n*(n-1)//2))
# Original solution
N = int(eval(input()))

sum = 0
for i in range(N):
    sum += i

print(sum)


# Optimized solution
N = int(eval(input()))
print((N*(N-1)//2))
# Original solution
n=int(eval(input()))
a=0
for i in range(1,n):
  a+=i
print(a)

# Optimized solution
n=int(eval(input()))
print((n*(n-1)//2))
# Original solution
n=int(eval(input()))
list1=[]
count2=1
ans_sum=[]
#list2=list(0 for _ in range(n))
for i in range(n):
    list1.append(i+1)
for i in range(n):
    count=count2
    ans=[]
    for j in range(n):
        ans.append(list1[j]%count)
        if count==n:
            count=1
        else:
            count+=1
        #print(ans)
    count2+=1
    ans_sum.append(sum(ans))
print((max(ans_sum)))


# Optimized solution
n=int(eval(input()))
ans=n*(n-1)//2
print((int(ans)))
# Original solution
N = int(eval(input()))

P = [(x + 2) for x in range(N-1)] + [1]
M = [i % P[i-1] for i in range(N)]
print((sum(M)))

# Optimized solution
N = int(eval(input()))

#P = [(x + 2) for x in range(N-1)] + [1]
#M = [i % P[i-1] for i in range(N)]
print(((N)*(N-1)//2))
# Original solution
n = int(eval(input()))
sum = 0
for i in range (n):
  sum += i
print(sum)
  

# Optimized solution
n = int(eval(input()))

print((n*(n-1)//2))
# Original solution
n = int(eval(input()))

answer = sum([i for i in range(n)])

print(answer)

# Optimized solution
import sys
input = sys.stdin.readline

a = int(eval(input()))

print((int((a-1)*(a)//2)))
# Original solution
n = int(eval(input()))
p_lst = [e for e in range(1,n+1)]
first, last = 1, n-1
res = (n-1)*(first+last)/2
print((int(res)))

# Optimized solution
n = int(eval(input()))
first, last = 1, n-1
res = (n-1)*n//2
print((int(res)))
# Original solution
n = int(eval(input()))
x= n-1

a = x*n
print((int(a//2)))



# Optimized solution
n = int(eval(input()))
x= n-1

a = x*n
print((a//2))
# Original solution
N = int(eval(input()))

ans = 0
for i in range(N):
    ans += i
print(ans)


# Optimized solution
N = int(eval(input()))

ans = N * (N-1) // 2

print(ans)
# Original solution
N = int(eval(input()))
print((sum([i for i in range(N)])))


# Optimized solution
N = int(eval(input()))
# print(sum([i for i in range(N)]))
print((N*(0 + N-1)//2))
# Original solution
n = int(eval(input()))
print((sum(range(n))))

# Optimized solution
n = int(eval(input()))
print(((n)*(n-1)//2))
# Original solution
n = int(eval(input()))
if n == 1:
  print((0))
  exit()
li = [i for i in range(n)]
ans = sum(li)
print(ans)

# Optimized solution
n = int(eval(input()))
ans = n * (n - 1) // 2
print(ans)
# Original solution
n = int(eval(input()))
print((n*(n-1)//2))

# Optimized solution
n = int(eval(input()))
ans = (n-1)*n//2
print(ans)
# Original solution
N = int(eval(input()))
P = [i%(i+1) for i in range(1,N)]
print((sum(P)))

# Optimized solution
N = int(eval(input()))
N = N-1
ans = N*(N+1)//2
print((int(ans)))
# Original solution
n = int(eval(input()))

ans = 0

for a,b in zip(list(range(1,n)),list(range(2,n+1))):
    ans += a % b
print(ans)

# Optimized solution
n = int(eval(input()))
ans = (n*(n-1))//2
print((int(ans)))
# Original solution
n = int(eval(input()))
print((sum(range(1,n))))

# Optimized solution
n = int(eval(input()))
print(((n*(n-1))//2))
# Original solution
N = int(eval(input()))

ans = 0

for i in range(N):

    if i == N-1:
        ans += 0
    else:
        ans += (i+1)%(i+2)

print(ans)

# Optimized solution
N = int(eval(input()))

#sum[i,1,N-1][i] = N*(N-1)/2

print((N*(N-1)//2))
# Original solution
print((sum(range(int(eval(input()))))))

# Optimized solution
n = int(eval(input()))-1
print((((2+n-1)*n ) >> 1))
# Original solution
# -*- coding: utf-8 -*-

N = int(eval(input()))

ans = 0
for y in range(1, N):
    ans += y

print(ans)


# Optimized solution
# -*- coding: utf-8 -*-

N = int(eval(input()))

ans = ((N + 1) * N) // 2
ans -= N

print(ans)
# Original solution
if __name__ == '__main__':
    n = int(eval(input()))
    r = [n]
    for i in range(1, n):
        r.append(i)
    ans = 0
    for i in range(n):
        ans += r[i] % (i + 1)
    print(ans)

# Optimized solution
if __name__ == '__main__':
    n = int(eval(input()))
    t = (1 + n) * n // 2
    print((t - n))
# Original solution
N = int(eval(input()))
score = 0

for i in range(1, N):
    score += i

print(score)


# Optimized solution
N = int(eval(input()))

print(((N)*(N-1)//2))
# Original solution
n = int(eval(input()))
a = 0
for i in range(n):
  a += i
print(a)

# Optimized solution
n = int(eval(input()))
a = n*(n-1)//2
print(a)
# Original solution
N = int(eval(input()))
a = list(range(1,N))
print((sum(a)))

# Optimized solution
N = int(eval(input()))
if N%2==0:
  N_=int(N/2)
  print((N_*(N-1)))
else:
  N_=int((N-1)/2)
  print((N_*N))
# Original solution
n = int(eval(input()))

ans=0

for i in range(n):
    ans += i

print(ans)

# Optimized solution
n = int(eval(input()))

ans = n*(n-1)//2

print(ans)
# Original solution
n = int( eval(input()))
total = 0
if n ==1:
    print((0))
else:
    for i in range(n):
        total += i
    print(total)

# Optimized solution
n = int( eval(input()))
total = 0
if n ==1:
    print((0))
else:
    print(((n*(n-1))//2))
# Original solution
N = int(eval(input()))

ans = 0
for i in range(1, N):
    ans += i

print(ans)


# Optimized solution
N = int(eval(input()))

ans =  (N*(N-1)) // 2
print((int(ans)))
# Original solution
n = int(eval(input()))

print((sum([i for i in range(1, n)])))


# Optimized solution
n = int(eval(input()))

ans = n * (n // 2)
if (n - 1) % 2 == 0:
   print(ans)
else:
   print((ans - int(n / 2)))
# Original solution
N = int(eval(input()))

intSum = 0
for i in range(N):
    intSum = intSum + i

print(intSum)

# Optimized solution
N = int(eval(input()))
count = int( (N-1) / 2 )

if (N-1) % 2 == 0:
    intSum = N*count
else:
    intSum = N*count + count + 1

print(intSum)
# Original solution
n = int(eval(input()))

ans_li = [i for i in range(1,n)]
print((sum(ans_li)))

# Optimized solution
n = int(eval(input()))

ans=0
if (n-1)%2==0:
    ans+=n*((n-1)//2)
else:
    ans+=n*((n-1)//2)+n//2
print(ans)
# Original solution
n=int(eval(input()))

if n==1: print((0)); exit();
if n==2: print((1)); exit();

if n%2==1:
  print((((n-1)+1)*((n-1)//2)))
else:
  print((((n-1)+1)*((n-1)//2)+n//2))

# Optimized solution
n=int(eval(input()))
if n==1: print((0)); exit();
if n==2: print((1)); exit();
print((n*(n-1)//2))
# Original solution
import sys
def input(): return sys.stdin.readline().strip()
def INT(): return int(eval(input()))
def MAP(): return list(map(int, input().split()))
def LIST(): return list(map(int, input().split()))

N = INT()
print((sum([i for i in range(N)])))


# Optimized solution
import sys
def input(): return sys.stdin.readline().strip()
def INT(): return int(eval(input()))
def MAP(): return list(map(int, input().split()))
def LIST(): return list(map(int, input().split()))

N = INT()
print((sum(range(N))))
# Original solution
import sys
def input(): return sys.stdin.readline().strip()
def INT(): return int(eval(input()))
def MAP(): return list(map(int, input().split()))
def LIST(): return list(map(int, input().split()))

N = INT()
ans=0
for i in range(N):
    ans +=i

print(ans)


# Optimized solution
n = int(eval(input()))
print(((n*(n-1))//2))
# Original solution
a = int(eval(input()))
sub = 0
for i in range(a):
  sub+=i
print(sub)

# Optimized solution
a = int(eval(input()))
sub = a*(a-1)//2
print(sub)
# Original solution
n = []
a = []
num = int(eval(input()))
for i in range(num):
    n.append(i+1)
    a.append(i+1)
a.pop(0)
a.append(1)
sum = 0
for c,d in zip(n, a):
    sum+= c % d
print(sum)



# Optimized solution
num = int(eval(input()))
sum = 0
for i in range(1, num+1):
    if i == num:
        sum += i % 1
    else:
        sum += i % (i+1)
print(sum)
# Original solution
N=int(eval(input()))
a=[i for i in range(N)]
print((sum(a)))

# Optimized solution
N=int(eval(input()))
if N % 2 ==1:
    ans=int((N-1)/2) * N
else:
    ans=int(N/2) * (N-1)
print((int(ans)))
# Original solution
n = int(eval(input()))
data = [i for i in range(1, n)]
print((sum(data)))

# Optimized solution
n = int(eval(input()))
print((int((n-1)*(1+n-1)//2)))
# Original solution
a = int(eval(input()))
num  = 0
for i in range(1,a):
    num += i
print(num)

# Optimized solution
a = int(eval(input()))
print((((a)*(a-1))//2))
# Original solution
n=int(eval(input()))
a=[]
for i in range(1,n):
  a.append(i%n)
print((sum(a)))

# Optimized solution
n=int(eval(input()))
c=0
for i in range(1,n):
    c+=(i%n)
print(c)
# Original solution
n = eval(input())
n = int(n)

ret = 0

for i in range(n-1):
    ret += (i+1)

print(ret)


# Optimized solution
n = eval(input())
n = int(n)

max_value = n - 1

ret = max_value * (max_value + 1) // 2

print(ret)
# Original solution
N = int(eval(input()))
n = [int(_) for _ in range(1, N)]
print((sum(n)))

# Optimized solution
N = int(eval(input()))
n = N - 1
ans = (n + 1) * n
ans //= 2
print(ans)
# Original solution
N = int(eval(input()))

arr = [i+1 for i in range(N)]
if N == 1:
    print((0))
else:
    print(((1+(N-1))*(N-1)//2))

# Optimized solution
N = int(eval(input()))

if N == 1:
    print((0))
else:
    print(((1+(N-1))*(N-1)//2))
# Original solution
N = int(eval(input()))

if N == 1:
    print((0))
else:
    print(((1+(N-1))*(N-1)//2))

# Optimized solution
N = int(eval(input()))

print(((1+(N-1))*(N-1)//2))
# Original solution
N = int(eval(input()))
ans = 0
for i in range(2,N+1):
  ans += (i-1)%i
print(ans)

# Optimized solution
N = int(eval(input()))

print(((N-1)*N//2))
# Original solution
N = int(eval(input()))

print((sum(range(N))))

# Optimized solution
N = int(eval(input()))

print((N*(N-1)//2))
# Original solution
n = int(eval(input()))
a = [i for i in range(1,n+1)]
print((sum(a)-max(a)))

# Optimized solution
n = int(eval(input()))
a = [i for i in range(1,n+1)]
print((sum(a)-n))
# Original solution
N=int(eval(input()))
lst=[N%1]
for i in range(2,N+1):
    lst.append((i-1)%i)
print((sum(lst)))

# Optimized solution
N=int(eval(input()))
print((N*(N-1)//2))
# Original solution
print((sum(range(1,int(eval(input()))))))

# Optimized solution
print(((lambda x:int(x)*(int(x)-1)//2)(int(eval(input())))))