CodeEff/ECCO huggingface dataset:
# Original solution
N = int(eval(input()))
ans = 0
for i in range(1, N):
    ans += i
print(ans)

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

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

zantei = 0

for i in range(1, N + 1):
	if N % i > i - 1:
		zantei = max(zantei, N % i - (i - 1))
		
print((zantei + ret))

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

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

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

# Optimized solution
n = int(eval(input()))-1
print((n*(n+1)//2))
# 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-1)*n//2))
# Original solution
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n = I()
    print((n*(n-1)>>1))
    return

#Solve
if __name__ == "__main__":
    solve()


# Optimized solution
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n = I()
    print((n*(n-1)>>1))
    return

#Solve
if __name__ == "__main__":
    solve()
# Original solution


n=int(eval(input()))

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

ans+=n%1

print(ans)



# Optimized solution


n=int(eval(input()))

ans=0
#for i in range(1,n):
#    ans+=i%(i+1)
#
#ans+=n%1

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

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

print(sum)

# Optimized solution
N = int(eval(input())) - 1
sum = 0

if N % 2 == 0:
  sum = (1+N)*int(N/2)
else:
  sum = (1+N)*int((N-1)/2) + int((N+1)/2)

print((int(sum)))
# Original solution
import sys


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


def solve():
    pass


def main():
    N = int(eval(input()))
    I = [x for x in range(1, N+1)]
    P = [x for x in range(1, N+1)]
    P = P[1:] + [P[0]]

    for i in range(N):
        I[i] %= P[i]

    print((sum(I)))


if __name__ == "__main__":
    main()


# Optimized solution
import sys


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


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


if __name__ == "__main__":
    main()
# Original solution
import math
N=int(eval(input()))
total=0
for i in range(N):
    total+=i
print(total)

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

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

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

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

print(ans)

# Optimized solution
import sys

n = int(eval(input()))

if n == 2:
    print((1))
    sys.exit()

# temp1 = (n-1) // 2
# temp2 = 2 + n - 2
#ans = ((n-1) / 2) * (2 + (n - 2))
ans = (n-1) * (2 + (n - 2))
ans = ans // 2
#ans = temp1 * temp2

#print(ans)
print((int(ans)))
# 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()))
ls = []
ls_re = []
for i in range(1,n+1):
    ls.append(i)
for i in reversed(ls):
    ls_re.append(i)

ans = 0
for i in range(n):
    ans += (ls[i]%ls_re[i])
    #print(ls[i]%ls_re[i],end=" ")

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

# Optimized solution
n = int(eval(input()))
'''
ls = []
ls_re = []
for i in range(1,n+1):
    ls.append(i)
for i in reversed(ls):
    ls_re.append(i)

ans = 0
for i in range(n):
    ans += (ls[i]%ls_re[i])
    #print(ls[i]%ls_re[i],end=" ")
'''
c = 0
for i in range(1,n):
    c += i
    
print(c)
# Original solution
n = int(eval(input()))
'''
ls = []
ls_re = []
for i in range(1,n+1):
    ls.append(i)
for i in reversed(ls):
    ls_re.append(i)

ans = 0
for i in range(n):
    ans += (ls[i]%ls_re[i])
    #print(ls[i]%ls_re[i],end=" ")
'''
c = 0
for i in range(1,n):
    c += i
    
print(c)
    

# Optimized solution
n = int(eval(input()))
c = 0    
an = (n-1)*n//2
print((round(an)))
# Original solution
from collections import defaultdict, deque, Counter
import sys
import heapq
import math

# input = sys.stdin.readline

sys.setrecursionlimit(1000000000)

MIN = -10 ** 9
MOD = 10 ** 9 + 7


def main():
    N = int(eval(input()))
    # A, B = [int(a) for a in input().split()]
    # H = [int(a) for a in input().split()]
    # A = [
    #     [int(a) for a in input().split()]
    #     for _ in range(N)
    # ]

    print((sum(a for a in range(1, N))))


if __name__ == '__main__':
    main()


# Optimized solution
from collections import defaultdict, deque, Counter
import sys
import heapq
import math

# input = sys.stdin.readline

sys.setrecursionlimit(1000000000)

MIN = -10 ** 9
MOD = 10 ** 9 + 7


def main():
    N = int(eval(input()))
    # A, B = [int(a) for a in input().split()]
    # H = [int(a) for a in input().split()]
    # A = [
    #     [int(a) for a in input().split()]
    #     for _ in range(N)
    # ]

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


if __name__ == '__main__':
    main()
# Original solution
n = int(eval(input()))
print((sum(range(0, n))))

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


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


if __name__ == '__main__':
    N = int(eval(input()))

    answer = solve(N)
    print(answer)


# Optimized solution
def solve(N):
    return (N * (N - 1)) // 2
 
 
if __name__ == '__main__':
    N = int(eval(input()))
 
    answer = solve(N)
    print((int(answer)))
# Original solution
N = int(eval(input()))

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

print(ans)

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

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

print(cnt)

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

A= []
for i in range(N-1):
    A.append(i+2)

A.append(1)

count = 0

for i in range(N):
    count += (i+1)%A[i]

print(count)

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

# Optimized solution
N = int(eval(input()))
print(((N + 1) * N // 2 - N))
# 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()))

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

# 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
def main(): 
    n = int(eval(input()))

    sum = 0

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

    print(sum)



if __name__ == "__main__":
    main() 

# Optimized solution
def main(): 
    n = int(eval(input()))

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

if __name__ == "__main__":
    main()
# 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 = 0
for i in range(n):
	ans += i
print(ans)

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


n = int(eval(input()))

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


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

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

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

# Optimized solution
n = int(eval(input()))
print((n*(n-1)//2))
# Original solution
#インポート
import sys

#入力用
def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def ISI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def II(): return int(sys.stdin.readline().rstrip())
def ISS(): return sys.stdin.readline().rstrip().split()
def IS(): return sys.stdin.readline().rstrip()

N = II()
A = [i for i in range(1,N+1)]
B = [0 for i in range(N-1)]
for i in range(N-1):
    B[i] = A[i+1]
B.append(A[0])
sum = 0
for i in range(N):
    sum += (i+1)%B[i]
print(sum)

# Optimized solution
#インポート
import sys

#入力用
def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def ISI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def II(): return int(sys.stdin.readline().rstrip())
def ISS(): return sys.stdin.readline().rstrip().split()
def IS(): return sys.stdin.readline().rstrip()

N = II()
sum = 0
for i in range(1, N+1):
    sum += i
print((sum-N))
# Original solution
#インポート
import sys

#入力用
def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def ISI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def II(): return int(sys.stdin.readline().rstrip())
def ISS(): return sys.stdin.readline().rstrip().split()
def IS(): return sys.stdin.readline().rstrip()

N = II()
A = [i for i in range(1, N+1)]
sum = sum(A)
print((sum-N))

# Optimized solution
#インポート
import sys
 
#入力用
def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def ISI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def II(): return int(sys.stdin.readline().rstrip())
def ISS(): return sys.stdin.readline().rstrip().split()
def IS(): return sys.stdin.readline().rstrip()
 
N = II()
sum = N*(1+N)//2
print((sum-N))
# Original solution
N = int(eval(input()))
mod_list = [i for i in range(1, N)]
output = (N - 1) / 2 * (1 + N - 1)

print((int(output)))

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

N = int(eval(input()))
ans = list(range(1, N))
print((sum(ans)))


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

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


# 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 - 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()))
print((sum(range(N))))

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

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


# 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(1, n):
    ans += i
print(ans)


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

# Optimized solution
N = int(eval(input()))
ans = sum(range(N))
print(ans)
# 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()))

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

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

Q = [i for i in range(1, N+1)]
P = sum(Q) - Q[-1]
print(P)


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

NL = []
PL = []
ans = 0

for i in range(N):
  NL.append(i+1)
  PL.append(i+2)
PL[N-1] = 1
  

for i in range(N):
  ans += NL[i] % PL[i]

print(ans)

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


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


if __name__ == "__main__":
    main()


# Optimized solution
from itertools import accumulate


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


if __name__ == "__main__":
    main()
# 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
num = int(eval(input()))

print((sum(range(1, num + 1)[:-1])))

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

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


# Optimized solution
n = int(eval(input()))
print(( ((n * (n+1))//2) - n ))
# 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()))
if N==1:
    print((0))
else:
    print((sum([i for i in range(1,N)])))

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

answer = sum(range(1, n))
print(answer)

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

answer = n * (n - 1) // 2
print(answer)
# 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()))
print((sum(x for x in 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(1,N):
  ans += i
print(ans)

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

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

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

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

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

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

ans = n * (n-1) // 2
print(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()))
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()))
A = [int(i) for i in range(1,N)]
print((N*(N-1)//2))


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

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

  
print((sum(range(1,a))))

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

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

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

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

print(ans)


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

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

P_list = []
M_list = []


for i in range(N):
    if i == N-1:
        P_list.append(1)

    else:
        P_list.append(i+2)


for i in range(N):
    M_list.append((i+1) % P_list[i])

print((sum(M_list)))

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

sum = 0

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

print(sum)


# りゅうせいの解答1　実行時間超過
#  N = int(input())
#
# P_list = []
# M_list = []
#
#
# for i in range(N):
#     if i == N-1:
#         P_list.append(1)
#
#     else:
#         P_list.append(i+2)
#
#
# for i in range(N):
#     M_list.append((i+1) % P_list[i])
#
# print(sum(M_list))
# Original solution
N = int(eval(input()))

sum = 0

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

print(sum)


# りゅうせいの解答1　実行時間超過
#  N = int(input())
#
# P_list = []
# M_list = []
#
#
# for i in range(N):
#     if i == N-1:
#         P_list.append(1)
#
#     else:
#         P_list.append(i+2)
#
#
# for i in range(N):
#     M_list.append((i+1) % P_list[i])
#
# print(sum(M_list))

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

mod_sum = N*(N-1)//2
print(mod_sum)

#りゅうせいの解答2 不正解2つあり
# N = int(input())
#
# mod_sum = int(N*(N-1)/2)
# print(mod_sum)

# りゅうせいの解答1　実行時間超過
#  N = int(input())
#
# P_list = []
# M_list = []
#
#
# for i in range(N):
#     if i == N-1:
#         P_list.append(1)
#
#     else:
#         P_list.append(i+2)
#
#
# for i in range(N):
#     M_list.append((i+1) % P_list[i])
#
# print(sum(M_list))
# 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()))

#1～nまでの数列
p = [i+1 for i in range(n)]
print((sum(p[:n-1])))


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

#1～n-1までの数列の和
print(((n-1)*n//2))
# Original solution
N = int(eval(input()))

S = sum(range(1,N))

print(S)

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

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

P = [i+1 for i in range(N)]

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

print(res)

# Optimized solution
# coding: utf-8
N = int(eval(input()))

res = sum(range(N))

print(res)
# Original solution
# coding: utf-8
N = int(eval(input()))

res = sum(range(N))

print(res)

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

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

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


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

N = int(eval(input()))
solve([N]+[i-1 for i in range(2, N+1)])



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

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

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

m_sum = 0
print((int(n*(n-1)//2)))
# Original solution
a = int(eval(input()))
numl = [i for i in range(2,a+1)] + [1]
ans = 0
for i in range(a):
    ans += (i+1) % numl[i]
print(ans)

# Optimized solution
a = int(eval(input()))
print((a*(a-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 = int(((n-1) * (n)) // 2)
print(ans)
# Original solution
N = int(eval(input()))
print((sum([ i for i in range(1, N)])))

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

# Optimized solution
N = int(eval(input()))
print((((N-1)*N)//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((int((n*(n-1))//2)))
# Original solution
N = int(eval(input()))
print((N * (N - 1) // 2))

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


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

# Optimized solution
a=int(eval(input()))
print((a*a-a>>1))
# Original solution
# -*- coding: utf-8 -*-
N=int(eval(input()))
ans=0
for i in range(N):
    ans=ans+i
print(ans)

# Optimized solution
# -*- coding: utf-8 -*-
N=int(eval(input()))
ans=((N-1)**2-(N-1))//2+(N-1)
print(ans)
# Original solution
def p_d():
    N = int(eval(input()))

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

    print(ans)


if __name__ == '__main__':
    p_d()


# Optimized solution
def p_d():
    N = int(eval(input()))

    print((N * (N - 1)//2))
    
if __name__ == '__main__':
    p_d()
# Original solution
N = eval(input())
N = int(N)
if not(1 <= N and N <= 10**9):
    exit()
ans = 0

if N % 2 == 0:
    for i in range(int(N/2)):
        ans += N+1
    ans -= N
else:
    for i in range(int(N/2)):
        ans += N
    
print(ans)

# Optimized solution
N = eval(input())
N = int(N)
if not(1 <= N and N <= 10**9):
    exit()
ans = 0

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

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

counter = 0

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

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

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

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

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

print(ans)
# Original solution
n = int(eval(input()))
ans = 0

if n == 1:
  ans = 0
else:
  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()))
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()))
number = [int(x)+1 for x in range(n)]

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

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

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

p = []

for i in range(n-1):
  p.append(i+2)
p.append(1)

for i in range(n):
  ans += (i+1) % p[i]

print(ans)



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

p = []

for i in range(n-1):
  ans += (i+1) % (i+2)

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

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

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