peterverebics/CodeNet_Python_118 huggingface dataset:
# coding:utf-8

import sys
import math
import time
#import numpy as np
import collections
from collections import deque
from collections import Counter
import queue
import copy
import bisect
import heapq
import itertools

#sys.setrecursionlimit(10**7)
#N, Q = map(int, input().split())
#G = [list(input()) for i in range(H)]
#INF = V * 10001
#A = [int(i) for i in input().split()]
#AB = [list(map(int, input().split())) for _ in range(K)]

N = int(input())
ans = (N-1)*(N)//2
print(int(ans))
N = int(input())
    
print((N - 1) * N // 2)
n = int(input())

print((n-1) * (n - 1 + 1) // 2)
N = int(input())
ans = (N-1)*N//2
print(ans)
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: sys.stdin.buffer.readline().rstrip()
rs = lambda: sys.stdin.buffer.readline().split()
ri = lambda: int(sys.stdin.buffer.readline())
rm = lambda: map(int, sys.stdin.buffer.readline().split())
rl = lambda: list(map(int, sys.stdin.buffer.readline().split()))

a = ri()
print((a * (a - 1)) // 2)
n=int(input())

ans=n*(n-1)//2
  
print(int(ans))
N = int(input())
ans = N * (N-1) // 2
print(ans)
N = int(input())

if N == 1:
  print(0)
  exit()

if N % 2 == 0:
  a = N//2
  ans = (N-1)*a
else:
  a = (N-1)//2
  ans = (N)*a

print(ans)
n = int(input())
print(((n+1)*n)//2-n)
N=int(input())
if N==1:
  print(0)
  exit(0)
#a=[i for i in range(1,N)]
#print(sum(a))
if (N-1)%2==0:
  print(N*((N-1)//2))
else:
  print(N*((N-1)//2)+((N-1)//2)+1)
N = int(input())

if (N -1) % 2 == 0:
  ans = N*(N-1)//2
else:
  ans = N*(N-2)//2 + N//2
  
print(ans)
A = int(input())  
print(int(A*(A-1)//2))
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

n = int(input())
ans = (n+1)*n//2-n
print(ans)
import math
N=int(input())
#print(sum([i for i in range(S)]))
"""
if s%2==0:
  ans=(1+s)*(s/2)
else:
  ans=(1+s)*int(s/2)+(int(s/2)+1)
"""
print(int(N*(N-1)//2))
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N = int(input())

    def sum_up_to_n(n):
        return n * (n + 1) // 2

    print(sum_up_to_n(N - 1))
    

if __name__ == '__main__':
    main()
n = int(input())

ans=0
if (n-1)%2==0:
    ans+=n*((n-1)//2)
else:
    ans+=n*((n-1)//2)+n//2
print(ans)
# ABC139 D - ModSum

#import itertools
N = int(input())
print(N * (N - 1) // 2)
"""
P = [i + 1 for i in range(N)]

for v in itertools.permutations(P, N):
    val = 0
    for i in range(N):
        val += (i + 1) % v[i]
    if val == 78:
        print(v, val)
"""
n = int(input())
 
ans = (1 + n) * n // 2
ans -= n
print(ans)
def q4():
    N = int(input())
    ans = N * (N-1) // 2
    print(ans)


if __name__ == '__main__':
    q4()
#!/usr/bin/env python

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

if __name__ == '__main__':
    main()
n = int(input())

ans = ((n - 1) * n) // 2
print(ans)
n = int(input())
s = (n*(n-1))//2
print(s)
import numpy as np
N = int(input())
print(N*(N-1)//2)
def main():
  N = int(input())

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

if __name__ == "__main__":
  main()
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(input())
    print(int(N*(N-1)//2))




if __name__ == "__main__":
    main()
n = int(input().strip())
ans = 0

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

print(ans)
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())

print(N*(N-1)//2)
n = int(input())
 
ans = (n*(n-1)//2)
 
print(int(ans))
import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inl = lambda: [int(x) for x in sys.stdin.readline().split()]
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))


def solve():
    n = ini()
    return n * (n - 1) // 2


print(solve())
n = int(input())
#答えが違う
#print(int(n*(n-1)/2))  # 合わない...
#print(int(n*(n-1)//2))  # 合わない...
print(n*(n-1)//2)
a=int(input())

print(((a - 1) * a // 2))
N = int(input())
if N % 2 == 0:
    print((1+N)*(N//2)-N)
else:
    print((1+N-1)*(N//2))
N = int(input())
n = N - 1

ans = n * (n + 1) // 2
print(ans)
N = int(input())

total = (N-1)* N // 2
print(total)
from collections import defaultdict
import bisect

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()


n = readInt()
print(n*(n-1)//2)
def main():
    n = int(input())
    ans = 0
    ans += n * (n - 1) // 2
    print(int(ans))

if __name__ == '__main__':
    main()
# -*- coding: utf-8 -*-
n = int(input())

sum_n = n * (1 + n) // 2
print(sum_n - n)
n = int(input())
d,m = divmod(n,2)
if m != 0:
    print(n*d)

else:
    print(n*(d - 1) + d)
n = int(input())
print(int(n * (n - 1) // 2))
import sys
from collections import deque
from bisect import bisect_left, bisect_right, insort_left, insort_right #func(リスト,値)
from heapq import heapify, heappop, heappush

sys.setrecursionlimit(10**6)
INF = 10**20

def mint():
    return map(int,input().split())
def lint():
    return map(int,input().split())
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])

N = int(input())
print(N*(N-1)//2)
n = int(input()) - 1
ans = (1 + n)*n//2

print(ans)
# Python3 (3.4.3)
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# function
# -------------------------------------------------------------


# -------------------------------------------------------------
# main
# -------------------------------------------------------------
N = int(input())

# i % i+1 = i が最善, あまりは 1 〜 N-1 
print(N*(N-1)//2)
n = int(input())
ans = (n+1) * (n//2) - n
if n%2 == 1:
    ans += n//2 + 1
print(ans)
N = int(input())
ret = (1 + N) * N // 2 - N 
# 1 2 3 4 5 6 7 8 9 10 11 12 13
# 2 3 4 5 6 7 8 9 10 11 12 13 1
print(ret)
n=int(input())
ans=n*(n+1)//2
ans-=n
print(ans)
N = int(input())

S = sum(range(1,N))

print(S)
import sys, heapq

N = int(input())

res = (N - 1) * N // 2
print(res)
from sys import stdin

n = int(stdin.readline().rstrip())
print((n - 1) * (n) // 2)
def main():
    N = int(input())
    ans = (N-1)*N//2

    print(ans)

    return 0
if __name__ == '__main__':
    main()
from math import ceil


def main():
    n = int(input()) - 1
    if n % 2 == 0:
        print(n * (n // 2) + n // 2)
    else:
        print(n * ceil(n / 2))


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

print(int((N)*(N-1)//2))
N=int(input())

print(  N*( N-1 )//2  )
N = int(input())
n = N - 1
print(n * (n+1)//2)
n = int(input())

result = (n * (n - 1)) // 2 
print(result)
def solve(n):
    return n * (n - 1) // 2

_n = int(input())
print(solve(_n))
# AtCoder
N = int(input())
ans = N*(N-1)//2
print(ans)
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n = inp()
print(n*(n-1)//2)
import sys
import itertools
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
n = int(input())

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

print(n * (n - 1) // 2)
N=int(input())
ans=N*(N-1)//2
print(ans)
N = int(input())
S = N*(N-1)//2
print(S)
from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    n = int(input())
    print(n * (n - 1) // 2)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()
n = int(input())
n-=1
print((n*(n+1))//2)
N = int(input())
ans = ( (N - 1) * N ) // 2
print(ans)
n = int(input())
print(n*(n+1)//2 - n)
N = int(input())
s = N - 1
ans = s*(1+s)//2
print(ans)
#!/usr/bin/env python
# -*- coding: utf-8 -*-


def solve(inp):
    N = int(inp.readline().strip())

    r = (N * (N - 1)) // 2
    return int(r)


def main():
    import sys
    result = solve(sys.stdin)
    if result is not None and result != '':
        print(result)


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

print(N * (N - 1) // 2)
def main():
  N = int(input())
  if N==1:
    print(0)
    return
  ans = sum(range(1,N))
  print(ans)
main()
n = int(input())
ans = (n * (n-1)) // 2
print(ans)
N=int(input())
value=(N-1)*(N-1+1)//2
print(value)
import sys
stdin=sys.stdin

ns = lambda:stdin.readline().rstrip()
ni = lambda:int(stdin.readline().rstrip())
nm = lambda:map(int,stdin.readline().split())
nl = lambda:list(map(int,stdin.readline().split()))

N=int(input())
print((N*(N-1)//2))
#python3
n=int(input())
n-=1
print(n*(n+1)//2)
n = int(input())
ans = 0
if n <= 2:
  ans = 1%n
else:
  ans = n*(n-1)//2
print(ans)
N=int(input())
n=N-1
res = n*(n+1)//2
print(res)
N = int(input())
Answer = N*(N-1)//2
print(int(Answer))
N = int(input())

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

if __name__ == "__main__":
    main()
# 初期入力
N = int(input())

#N_list =[i for i in range(1,N+1)]
N_list_sum =N*(N+1)//2
ans =N_list_sum -N
print(ans)
n = int(input())

ans = ((n+1)*n)//2-n
    
print(int(ans))
N = int(input())

ans = N*(N-1)//2
print(ans)
# import sys
# sys.setrecursionlimit(10 ** 6)
# import bisect
# from collections import deque
# from decorator import stop_watch
# 
# 
# @stop_watch
def solve(N):
    n = N - 1
    print((n + 1) * n // 2)


if __name__ == '__main__':
    # S = input()
    N = int(input())
    # N, M = map(int, input().split())
    # As = [int(i) for i in input().split()]
    # Bs = [int(i) for i in input().split()]
    solve(N)
import sys
from bisect import *
from heapq import *
from collections import *
from itertools import *
from functools import *

sys.setrecursionlimit(100000000)
input = lambda: sys.stdin.readline().rstrip()

N = int(input())
print(N * (N - 1) // 2)
n = int(input())
if n == 1 :
    print(0)
elif n == 2 :
    print(1)
else :
    print(n*(n-1)//2)
N = int(input())

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

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

print(ans)
N = int(input())

if N == 1:
    print(0)
else:
    print((N)*(N-1)//2)
import itertools
n = int(input())
#
# lst = []
# for v in itertools.permutations(range(1,n+1),n):
#     tmp = 0
#     for i in range(n):
#         tmp += (i+1) % v[i]
#     lst.append(tmp)
# print(max(lst))
ans = 0
for i in range(1,n):
    ans += i
print(ans)
N = int(input())
if N % 2 == 0:
    print(int(N/2) * (N-1))
else:
    print(int((N-1)/2) * N)
def main():
    N=int(input())
#    print(N)
    print(N*(N-1)//2)
    return

if __name__=='__main__':
    main()
num = int(input())

print(((num - 1) * num) // 2)
N=int(input())
N=N-1
ans=(N+1)*N//2
print(ans)
#!/usr/bin/env python
# coding: utf-8

def ri():
    return int(input())

def rl():
    return list(input().split())

def rli():
    return list(map(int, input().split()))

def main():
    n = ri()
    print(((n-1)*n)//2)


if __name__ == '__main__':
    main()
n = int(input())
ret = (1 + (n - 1)) * (n - 1) // 2
print(ret)
n = int(input())
n -= 1

print(n*(n+1)//2)
n = int(input())

m_sum = 0
print(int(n*(n-1)//2))
import sys
input = sys.stdin.readline

n = int(input())
ans = (n * (n - 1)) // 2
print(ans)
import sys
sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline
from itertools import permutations,  combinations, accumulate
from functools import *
from collections import deque, defaultdict, Counter
from heapq import heapify, heappop, heappush, heappushpop

INF = float('inf')
NIL = - 1


# def gen_counter(stop=10):
#     index = 1
#     while True:
#         if stop < index:
#             break
#         yield index
#         index += 1


N = int(input())
res = (N - 1) * N // 2
print(res)


# arr = np.arange(1, N + 1)
# t_arr = np.append(arr[1:], arr[0])
# print(sum(arr % t_arr))
n = int(input())
ans = (n - 1) * n // 2
print(ans)
import sys
import heapq


input = sys.stdin.readline
n = int(input())
result = n*(n-1)//2
print(result)
# input
N = int(input())

# check
print(N * (N - 1) // 2)
def readinput():
    n=int(input())
    return n

def main(n):
    return n*(n-1)//2

if __name__=='__main__':
    n=readinput()
    ans=main(n)
    print(ans)
import heapq
t = 1
def max(a,b):
	if a > b:
		return a
	return b
def min(a,b):
	if a < b:
		return a
	return b

while t > 0:
	t -= 1
	# a,b = map(int,input().split())
	n = int(input())
	ans = (n-1)*(n)//2
	print(ans)
	# v = list(map(int,input().strip().split()))[0:n]
	# i = 0
	# ans = 0
	# while i < n:
	# 	j = i
	# 	while j+1 < n and v[j+1] <= v[j]:
	# 		j += 1
	# 	l = j-i+1
	# 	ans = max(ans,l)
	# 	i = j+1
	# print(ans-1)
n = int(input())
total = 0
print(n*(n-1)//2)
N = int(input())
print(N * (N + 1) // 2 - N)
N = int(input())

if N % 2 == 0:
    result = N // 2
    result = result * (N - 1)
elif N % 2 == 1:
    result = (N - 1) // 2
    result = result * N

print(result)
# D - ModSum

N = int(input())
print(N * (N - 1) // 2)
n = int(input())
ans = ((n-1)*n)//2

print(ans)
from sys import stdin

n = int(stdin.readline().rstrip())

print(n*(n-1)//2)
# -*- coding: utf-8 -*-
 
## Library
 
import sys
from fractions import gcd
import math
from math import ceil,floor
import collections
from collections import Counter
import itertools
 
## input
 
# N=int(input())
# A,B,C,D=map(int, input().split())
# S = input()
# yoko = list(map(int, input().split()))
# tate = [int(input()) for _ in range(N)]
# N, M = map(int,input().split()) 
#    P = [list(map(int,input().split())) for i in range(M)]
 
N=int(input())

# 1 2 3 4 5
# 2 3 4 5 1

ans = 0

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

print(ans)
# ABC139
# D
# ModSum

n = int(input())
print(n*(n-1)//2)
import sys
input = sys.stdin.readline

# D - ModSum
n = int(input())

if (n-1) % 2 == 0:
	ans = n * (n-1)//2
else:
	ans = (n-1) * n//2

print(ans)
N = int(input())
ans = N * (N-1) // 2
print(int(ans))
n = int(input())

total = n*(n-1)//2
  
print(total)
'''Haha this is python? How could you tell, Sherlock?'''

n = int(input())
print((n * (n - 1)) // 2)
N = int(input())

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

print(ans)
# D
n = int(input())
print(n*(n-1)//2)
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n=int(input())
    print((1+n)*n//2-n)
resolve()
def myAnswer(N:int) -> int:
   N -=1
   return N * (N + 1) // 2

def modelAnswer():
   return
def main():
   N = int(input())
   print(myAnswer(N))
if __name__ == '__main__':
   main()
n = int(input())

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

print((N) * (N-1) // 2)
N = int(input())
print((N * (N - 1)) // 2)
#!/usr/bin/env python3

N = int(input())

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

print(ans)
N=int(input())
ans= N*(N-1)//2
print(ans)
import math 
import bisect
import heapq
from collections import deque

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

print(int(n * (n-1) // 2))
import sys
import math
import itertools as it
def I():return int(sys.stdin.readline().replace("\n",""))
def I2():return map(int,sys.stdin.readline().replace("\n","").split())
def S():return str(sys.stdin.readline().replace("\n",""))
def L():return list(sys.stdin.readline().replace("\n",""))
def Intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":
    n = I()
    n -= 1
    print(n*(n+1)//2)
def solve(n):
    return n * (n - 1) // 2


N = int(input())

print(solve(N))
A = int(input())
ans = A*(A-1)/2

print(ans)
n = int(input())
ans = (n-1)*n/2

print(int(ans))
n=int(input())
ans=int((n-1)*n/2)
print(ans)
import math
N = int(input())
print(int(N*((N-1)/2)))
#!/usr/bin/env python
# -*- coding: utf-8 -*-


def solve(inp):
    N = int(inp.readline().strip())

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

    return r


def main():
    import sys
    result = solve(sys.stdin)
    if result:
        print(result)


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

if N == 1:
    print(0)
else:
    if N % 2 == 0:
        ans = N * (N/2 - 1) + N/2
    else:
        ans = N * (N-1)/2
    print(int(ans))
n = int(input())
ans = int((n-1)*n*0.5)
print(ans)
from math import floor
N = int(input())
if N%2 == 0:
    ans = (1+N-1)*((N-1)//2) + floor((N-1)/2)
else:
    ans = (1+N-1)*((N-1)//2)
print(ans)
# AtCoder
N = int(input())
ans = N*(N-1)/2
print(int(ans))
a=int(input())

print(int((a - 1) * a / 2))
N = int(input())
#Mi=i%(i+1) (1<=i<N),
#   i%1     (i=N)

ans = N*(N-1)/2

print(int(ans))
n = int(input())
print(int(n * (n - 1) / 2))
n = int(input())
print(int(1/2*(n-1)*n))
n = int(input())

if n == 1:
    print("0")
else:
    ans = (n-1)*n/2
    print(int(ans))
N = int(input())


print(int(N*(N+1)/2-N))
n = int(input()) - 1
ans = n * (n + 1) / 2
print(int(ans))
import itertools

N = int(input())

print(int(N*(N-1)/2))
N = int(input())

print(int(N * (N-1) * 1/2))
n = int(input())

a = 1
b = n - 1
ans = int((n - 1) * (a + b) / 2)
print(ans)
N = int(input())
print(int((N*(int(N-1)))/2))
n=int(input())
print(int(0.5*n*(n-1)))
N = int(input())

if N == 1:
    print(0)

else:
    print(int(N * (N - 1) / 2))
n = int(input())
print(int(((1+n)/2)*n - n))
N = int(input())
A = N*(N+1)/2-N
print(int(A))
from sys import stdin
import math
import fractions
import heapq

n = int(stdin.readline().rstrip())

cnt = int((1 + (n-1)) * (n-1) / 2)

print(cnt)
N=int(input())

print(int(N*(N-1)/2+0.5))
N = int(input())

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

print(int(ans))
n = int(input())
n = n-1
s = (n/2)*((2*1)+(n-1))

print(int(s))
N=int(input())
Q=(1+N)*N/2-N
print(int(Q))
def main():
    n = int(input())
    ans = 0 
    ans += (n) * (n + 1) / 2
    print(int(ans) - n)

if __name__ == '__main__':
    main()
#D ModSum
n=int(input())
print(int(n*(n-1)/2))
### ----------------
### ここから
### ----------------

import sys
from io import StringIO
import unittest

def yn(b):
    print("Yes" if b==1 else "No")
    return

def resolve():
    readline=sys.stdin.readline

    n=int(readline())
    ans=int((1+n-1)/2 * (n-1))
    
    print(ans)

    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

### ----------------
### ここまで 
### ----------------
N = int(input())

ans = int(0.5 * N * (N - 1))

print(ans)
n = int(input())
if n % 2 == 1:
    print(n * (n // 2))
else:
    print((n * n - n) / 2)
def main():
    n = int(input())
    print(n * (n - 1) / 2)


main()
N = int(input())
print("{:}".format(int((N-1)*N/2)))
def main():
    '''
    N = aq + r (0 <= r <= a-1)よりΣrを最大にするのはr = a-1のとき 
    '''
    N = int(input())
    N -= 1
    print(N * N // 2)


if __name__ == '__main__':
    main()
N = int(input())
print(int(N * (N-1) / 2))
N=int(input())
if N==2:
    print("1")
else:
    print(N*(N//2))
import math
n = int(input())
if (n-1)%2 == 0:
    ans = n*((n-1)/2)
else:
    ans = n * math.floor((n-1)/2) + math.ceil((n-1)/2)

print(int(ans))
import math

n = int(input())

_sum = int(n / 2) * (n + 1)

print(_sum - n)
def abc139d():
    n = int(input())
    print(int(n*((n-1)/2)))
abc139d()
A = int(input())  - 1
if A ==0 :print(A)
else : print(int(A*(A+1)/2))
N = int(input())

ans = N*(N-1)/2
print(int(ans))
n=int(input())
ans=n*(n-1)/2
print(int(ans))
N = int(input())
count =0.01
count = int(N*(N-1)/2)
print(int(count))
n = int(input())
print(n * (n + 1) // 2)
N = int(input())


print(int((N/2) * (N - 1)))
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Created: Jul, 14, 2020 11:34:55 by Nobody
# $Author$
# $Date$
# $URL$
__giturl__ = "$URL$"


from sys import stdin
input = stdin.readline


def main():
  N = int(input())

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


if(__name__ == '__main__'):
  main()
N = int(input())
print(int((1/2)*N*(N-1)))
N = int(input())
a = N*(N-1)/2
a = int(a)
print(a)
n = int(input())

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

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

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

# print(ans)

ans = int(n / (n-1) * (n-1) ** 2 / 2)
print(ans)
N = int(input())

if N == 1:
  print(0)
elif N == 2:
  print(1)
else:
  total = (N*(N-1))/2
  print(int(total))
#!/usr/bin/env python
# -*- coding: utf-8 -*-


def solve(inp):
    N = int(inp.readline().strip())

    r = (N * (N - 1)) / 2
    return int(r)


def main():
    import sys
    result = solve(sys.stdin)
    if result:
        print(result)


if __name__ == '__main__':
    main()
n = int(input())
ans = (n-1)*n*0.5
print(int(ans))
def resolve():
    n=int(input())
    sum=int((n*(1+n)/2))
    print(sum-n)
resolve()
n = int(input())
ans = 0
n -= 1
if n % 2 == 0:
  ans = (n+1)*n//2
else:
  ans = (n+1)*n//2 + n//2
print(ans)
import math
n = int(input())
ans = 0.5 * (n-1)*n
print(int(ans))
def main():
    n = int(input())

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

    # print(ans)

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

if __name__ == '__main__':
    main()
n=int(input())
ans=n*(n-1)/2

print(ans)
N = int(input())
print(int((1/2)*N*(N-1)+0.5))
N=int(input())

print(int(N*(N-1)/2+0.2))
n = int(input())

ans = ((n-1)*n)/2
    
print(int(ans))
n = int(input())
print(int((n-1)*n*0.5) )
N = int(input())
print(int(1/2*N*(N-1)))
def main():
    N = int(input())
    res = N*(N-1)/2
    print(int(res))
    
main()
n = int(input())
print(int(n*(0+n-1)/2))
n = int(input())
print((n-1)//2 * (1 + (n-1)))
n = int(input())

print(int(0.5*n*(n-1)))
N = int(input())

ans = int((N-1) * (1+N-1)/2)
if N == 1:
    print(0)
    exit()
print(ans)
n = int(input())
ans = int((n-1)*(n-2)/2)
print(ans)
import sys
stdin=sys.stdin

ns = lambda:stdin.readline().rstrip()
ni = lambda:int(stdin.readline().rstrip())
nm = lambda:map(int,stdin.readline().split())
nl = lambda:list(map(int,stdin.readline().split()))

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


main()
n = int(input())

ans = (n-1)*n/2

print(int(ans))
N = int(input())
if N % 2 == 0:
  print(int(N / 2 * (N - 1)))
else:
  print(int((N - 1) / 2 * N))
import math
import collections
import itertools

def YesNo(Bool):
    if(Bool):
        print("Yes")
    else:
        print("No")
    return

def resolve():

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

    print(int(ans))

resolve()
n = int(input())

ans = ((n+1)*n)/2-n
    
print(int(ans))
N=int(input())
ans = int(1/2 * (N-1) * N)
print(ans)
n = int(input())
ans = n*(n-1)*0.5
print(int(ans))
n=int(input())
print(int(0.5*n*(n+1)-n))
import bisect

n = int(input())

print(n*(n-1)/2)
import decimal
n=int(input())

total = decimal.Decimal( (1+(n-1))*(n-1)/2 )
print(total)
n = int(input())
result = 0
for i in range(n):
    if i == 0:
        result += 1
    elif i == n-1:
        result += 0
    else:
        result += (i+1)%(i+2)
print(result)
n = int(input())
ans = 0
for i in range(n):
    ans += i
    ans = ans % (10**9 + 7)
print(ans)
# input
N = int(input())

# check
print((2 * N - 1) // 2)
def main():
    n = int(input())
    ans = 0
    ans += n * (n - 1) / 2
    print(int(ans))

if __name__ == '__main__':
    main()
n=int(input())
print(int((n * (n-1)) / 2 ))
n=int(input())

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

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

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

# print(ans)

ans = int(n * (n-1) / 2)
print(ans)
N=int(input())
ans=N*(N-1)/2
print(int(ans))
n = int(input())

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

ans = (n-1)*(1+n-1)/2
print(int(ans))
n = int(input())

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

print(m)
n = int(input())
ans = n * (n - 1) / 2
print(int(ans))
n = int(input())
if n == 1 :
    print(0)
elif n == 2 :
    print(1)
else :
    print(int((1+n-1)*(n-1)/2))
import math
N=int(input())
#print(sum([i for i in range(S)]))
"""
if s%2==0:
  ans=(1+s)*(s/2)
else:
  ans=(1+s)*int(s/2)+(int(s/2)+1)
"""
print(int(N*(N-1)/2))