peterverebics/CodeNet_Python_118 huggingface dataset:
import sys
read = sys.stdin.readline
import time
import math
import itertools as it
def inp():
    return int(input())
def inpl():
    return list(map(int, input().split()))
start_time = time.perf_counter()
# ------------------------------

n = inp()
print(int(0.5*(n-1)*(1+n-1)))

# -----------------------------
end_time = time.perf_counter()
print('time:', end_time-start_time, file=sys.stderr)
N = int(input())

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


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


if __name__ == '__main__':
    main()
n = int(input())
if n == 1:
    print(0)
else:
    s = n * (n - 1) / 2 
    print(int(s))
import sys
import heapq


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

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

if N == 1:
  print(0)
else:
  total = int((N-1)*(2*1+(N-2)*1)/2)
  print(total)
"""
total = 0
for i in range(1,N+1):
  total += i-1
print(total)
"""
N = int(input())

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

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

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

if n == 1:
    print("0")
else:
    ans = ((n-1)*n)/2
    print(int(ans))
N = int(input())
ans = 1/2 * N * (N-1)
print(int(ans))
n = int(input())
ans = (((n+0.5)**2)/2)-n
print(int(ans))
import sys
from collections import deque
import itertools
from collections import deque
sys.setrecursionlimit(10 ** 9)
import heapq
import numpy as np

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


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


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

    pass



if __name__ == "__main__":
    main()
from math import floor
N = int(input())
if N == 2:
    ans = 1
elif N%2 == 0:
    ans = (1+N-1)*((N-1)//2) + floor((N-1)/2)
else:
    ans = (1+N-1)*((N-1)//2)
print(ans)
def main():
    N=int(input())
#    print(N)
    print(int(N*(N-1)/2))
    return

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

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

print(ans)
# 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())
ans = int(N*(N-1)/2)

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

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

if N == 1:
    print(0)

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

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

ans = (N-1) * (N) / 2
print(int(ans))
if __name__ == '__main__':
    n = int(input())
    t = (1 + (n - 1) * (n - 1)) // 2
    print(t)
N = int(input())
ans = N*(N+1)/2-N
print(ans)
#!/usr/bin/env python3
import sys
N = int(input())
if N == 2:
    print(1)
    sys.exit()

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


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

if N == 1:
  print(0)
elif N == 2:
  print(1)
else:
  total = ((N-1)*N)/2
  print(int(total))
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(int(N*(N-1)/2))
n = int(input())
ans = (n*(n-1))/2
print(int(ans))
import math

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

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

# In[8]:


P = int(input())


# In[12]:


# i_list = list(range(1, P+1))
# p_list = i_list[1:]
# p_list.append(i_list[0])

# # print(i_list, p_list)

# ans = 0
# for i in range(P):
#     ans += i_list[i]%p_list[i]
# print(ans)

ans = sum(range(1,P+1))
print(range(1,P+1), ans)


# In[ ]:
n = int(input())
a = int(n*(n-1)/2)
if n<=2 or n%2 == 1:
    print(a)
else:
    print(a-1)
n = int(input())
counter = n*(n-1)/2
print(int(counter))
N = int(input())
print("{:.0f}".format((N-1)*N/2))
N =int(input())



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

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

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

print(int(N * (N-1) /2))
import random
N = 13

P = [i for i in range(1,N+1)]
M = 0
for i in range(1,N+1):
  M += max(i%P[j] for j in range(N))

print(M)
mod=10**9+7
import math
import sys
from collections import deque
import heapq
import copy
import itertools
from itertools import permutations
from itertools import combinations
import bisect
def mi() : return map(int,sys.stdin.readline().split())
def ii() : return int(sys.stdin.readline().rstrip())
def i() : return sys.stdin.readline().rstrip()
a=ii()
print(int(a*(a-1)/2))
n=int(input())
out=n*(n-1)/2
print(int(out))
n = int(input())
print(int((n-1)/2 * (1 + (n-1))))
def main():
    N = int(input())
    res = N*(N-1)/2
    print(res)
    
main()
N = int(input())

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

n = int(input())

_sum = n / 2 * (n + 1)

print(int(_sum - n))
N = int(input())
result = 0

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

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

ans = int(N*(N-1)/2)
print(ans)
# Problem D - ModSum

# input
N = int(input())

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

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

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

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

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

print(ans)
#!/use/bin/env python3

a = input()

b = int(a)

ans = b * ((b - 1) // 2) if b != 2 else 1

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

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

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

main()
mod=10**9+7
import math
import sys
from collections import deque
import heapq
import copy
import itertools
from itertools import permutations
from itertools import combinations
import bisect
def mi() : return map(int,sys.stdin.readline().split())
def ii() : return int(sys.stdin.readline().rstrip())
def i() : return sys.stdin.readline().rstrip()
a=ii()
print(a*(a-1)/2)
n=int(input())
print(int((n-1)*n*0.5))
import numpy as np

N = int(input())

answer = N * (N - 1) / 2

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

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

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

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

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

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

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

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

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

ans = (N-1) * N / 2
print(ans)
n = int(input())
print(int((1/2)*n*(n-1)))
n=int(input())
print(int((1/2)*n*(n-1)))
N=int(input())
ans = int((N-1) * N / 2)
print(ans)
import sys
from math import ceil, floor, sqrt, sin, cos, pi
from itertools import accumulate, permutations, combinations
from fractions import gcd # 最大公約数
from collections import deque, Counter
from operator import itemgetter
from heapq import heappop,heappush
sys.setrecursionlimit(10**7)
def lcm(x, y): return ((x * y) // gcd(x, y)) # 最小公倍数
# list(map(int, input().split()))

n = int(input())
print(floor(n*(n-1)*0.5))
### ----------------
### ここから
### ----------------

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) * (n-1) / 2)
    
    print(ans)

    return

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

### ----------------
### ここまで 
### ----------------
def main():
    n = int(input())
    print(int(n*(n+1)/2 - n))


if __name__ == '__main__':
    main()
def abc139d():
    n = int(input())
    print((n*((n-1)//2)))
abc139d()
n=int(input())
print(int((n-1)*int(n/2)))
N = int(input())
print(int((N - 1) * N / 2))
import sys
import copy
import math
import itertools
import numpy as np
N = int(input())
print(int(N*(N-1)/2))
n = int(input())

counter = n*(n-1)/2
  
print(int(counter))
n = int(input())
a =n*(n-1)/2
print(int(a))
def q4():
    N = int(input())
    ans = N*(N-1)/2
    print(int(ans))


if __name__ == '__main__':
    q4()
N = int(input())
ans = (1 + N - 1) * (N - 1) / 2
print(int(ans))
N = int(input())

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

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

print(int((N * (1 + N)) / 2 - N))
N = int(input())
s = int(N*(N-1)/2)
print(s)
import sys
import heapq


input = sys.stdin.readline
n = int(input())
n -= 1
print(int(n/2)*(n+1))
n=int(input())
ans=(n*(n-1))/2
print(int(ans))
def main():
    n = int(input())
    ans = round(n*(n-1)/2)
    print(ans)
    
if __name__ == '__main__':
    main()
#!/usr/bin/python3
# -*- coding:utf-8 -*-

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

if __name__=='__main__':
  main()
import math

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

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

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

if __name__ == '__main__':
    main()
# 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)*0.5
print(int(ans))
N = int(input())
a = N - 1
print(int(a*(a+1)/2))
N = int(input())

if N == 1:
  print(0)
else:
  total = int((N-1)*(2+(N-2))/2)
  print(total)
"""
total = 0
for i in range(1,N+1):
  total += i-1
print(total)
"""
N=int(input())
Q=N*(N-1)/2
print(int(Q))
r = int(input())
if (r-1) % 2 == 0:
    print(int((1 + (r-1)) * (r-1) / 2))
else:
    print(int((1 + (r-1)) * (r-1) / 2))
#!/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(round((N-1)*N/2))


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

m = int((n-1)*n*0.5)

print(m)
n = int(input())

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


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

print(int((n-1)*(1+n-1)/2))
a=int(input())
b=[i for i in range(2,a)]
n=((2+(a-1))*(len(b)))//2

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

if N == 1:
    print(0)
elif N == 2:
    print(0)
else:
    print((N-1)*(N-2)//2)
from sys import stdin
import math
import fractions
import heapq

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

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

print(cnt)
import sys
import heapq


input = sys.stdin.readline
n = int(input())
n -= 1

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

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


if __name__ == '__main__':
    main()
N=int(input())
ans=N*(N-1)*0.5
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=0
for i in range(2,N):
    ans+=i
print(ans+1)
N = int(input())-1

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

total = ((N-1)*N)/2
print(int(total))
n=int(input())
if n==1:
  print(1)
else:
  print(int((n*(n-1)/2)))
n = int(input())
if n == 1:
  print(0)
else:
  S = 1/2 * (n-1) * n
  print(int(S))
N = int(input())
ans = (N * (N - 1)) / 2
print(int(ans))
N = int(input())
Answer = N*(N-1)/2
print(int(Answer))
s=int(input())
ans=s*(s-1)/2
print(int(ans))
n = int(input())
if n == 1 or n == 2:
    print(1)
else :
    print(int((1+n-1)*(n-1)/2))
N = int(input())
print((N-2)*(N-1)//2)
n = int(input())
print(int(0.5 * (n - 1) * n))
#!/usr/bin/env python3

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

print(int(N*(N+1)/2)-N)
a=int(input())
#_l=list(map(int,input().split()))

print(int((a*(a-1))/2))
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()
def main():
    n = int(input())
    print(n*(n-1)/2)

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

print( int( N*( N-1 )*0.5 )  )
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)
n = int(input())

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

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

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

print(ans)
n = int(input())
re=int((n * (n-1)) / 2)
print(re)
S=int(input())
#print(sum([i for i in range(S)]))
s=S-1
if s%2==0:
  ans=(1+s)*(s/2)
else:
  ans=(1+s)*int(s/2)+(int(s/2)+1)
print(int(ans))
n=int(input())
ans=(1+n)*n//2
print(ans-1)
n=int(input())
if n==1:
    print(0)
else:
    print(int(1/2*(n-1)*n))
N = int(input())
print( int(((N-1)*N)/2) )
import sys
import math
import fractions
import itertools
from collections import deque
import copy
import bisect

MOD = 10 ** 9 + 7
INF = 10 ** 18 + 7
input = lambda: sys.stdin.readline().strip()

N = int(input())
print(int(N * (N - 1) / 2))
#5 0413(Youtube)
n=int(input())

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

print(ans)
# -*- coding: utf-8 -*-

n=int(input())

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

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

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

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

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

    # print(ans)

    print(int(0.5 * (n-1) * n))

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

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


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

total = int( (1+(n-1))*(n-1)/2 )
print(total)
import math

n = int(input())

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

print(_sum - n)
import bisect

n = int(input())

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

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


print(int((1/2) * N * (N - 1)))
def resolve():
    N = int(input())
    #ary = [N] + list(range(1, N))
    print(int(0.5*N*(N-1)))



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

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

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


if __name__ == "__main__":
    main()
A = int(input()) - 1
import math
print(math.floor((1+A) * (A/2)))
N = int(input())
print(int(N*(N-1)*0.5))
N=int(input())
print(max(int(N*(N-1)/2),int(N*(N+1)/2)-2*int(N/2)-1))
N = int(input())
print(int((N * (N-1) / 2)))
n=int(input())
n-=1
ans=int(n*(n+1)*0.5)
# Problem D - ModSum

# input
N = int(input())

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

# output
print("%d"%(ans))
N = int(input())
if N == 1:
    res = 0
elif N == 2:
    res = 1
else:
    res = N * (N - 1) // 2 - 1
    if N % 2 == 1:
        res += 1
print(res)
N=int(input())
print(min(int(N*(N-1)/2),int(N*(N+1)/2)-2*int(N/2)-1))
n = int(input())
#n = 13
ans = int(((n-1)*n/2))
print(ans)
N = int(input())

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

print(int(ans))
#!/usr/bin/env python
# coding: utf-8

# In[21]:


P = int(input())


# In[22]:


# i_list = list(range(1, P+1))
# p_list = i_list[1:]
# p_list.append(i_list[0])

# # print(i_list, p_list)

# ans = 0
# for i in range(P):
#     ans += i_list[i]%p_list[i]
# print(ans)

# ans = sum(range(1,P))
ans = int(P*(P-1)/2)
print(ans)


# In[ ]:
import math
n = int(input())
if (n-1)%2 == 0:
    a = (n-1)/2
    ans = n*a
else:
    ans = n * math.floor((n-1)/2) + math.ceil((n-1)/2)

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

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

ans = round((N-1) * (1+N-1)/2)
if N == 1:
    print(0)
    exit()
print(ans)
import sys
import heapq


input = sys.stdin.readline
n = int(input())
n -= 1

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

result = int(n/2) * (n+1)
print(result)
n = int(input())
if n == 1 or n % 2 == 0:
    print(int((n*(n-1))/2))
else:
    print(int(n%2 + (n*(n-1))/2 - 1))
mod=10**9+7
import math
import sys
from collections import deque
import heapq
import copy
import itertools
from itertools import permutations
from itertools import combinations
import bisect
def mi() : return map(int,sys.stdin.readline().split())
def ii() : return int(sys.stdin.readline().rstrip())
def i() : return sys.stdin.readline().rstrip()
a=ii()
if a%2==0:
  a=a//2
  print(a*(a-1))
else:
  b=(a-1)//2
  print(a*b)
n=int(input())
ans=(n*(n-1))/2
ans=int(ans)
print(ans)
N = int(input())
print(int((N-1)*(N) / 2))
import sys
#input = sys.stdin.readline

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

if __name__ == '__main__':
    main()
S=int(input())
#print(sum([i for i in range(S)]))
s=S-1
"""
if s%2==0:
  ans=(1+s)*(s/2)
else:
  ans=(1+s)*int(s/2)+(int(s/2)+1)
"""
print(s*(s+1)/2)
N = int(input())
result = 0

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

if n%2 == 0:
	print((int)(n/2*(n-1)))
else:
	print((int)((n-1)/2*n))
A = int(input())  - 1
if A ==0 :print(A)
else : print(int(A*(A-1)/2))
#!/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()
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()

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

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

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

if N == 1:
    print(1)
else:
    print((1+(N-1))*(N-1) // 2)
#!/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(str(result))


if __name__ == '__main__':
    main()
import sys
from math import ceil, floor, sqrt, sin, cos, pi
from itertools import accumulate, permutations, combinations
from fractions import gcd # 最大公約数
from collections import deque, Counter
from operator import itemgetter
from heapq import heappop,heappush
sys.setrecursionlimit(10**7)
def lcm(x, y): return ((x * y) // gcd(x, y)) # 最小公倍数
# list(map(int, input().split()))

n = int(input())
print(round(n*(n-1)*0.5))
mod=10**9+7
import math
import sys
from collections import deque
import heapq
import copy
import itertools
from itertools import permutations
from itertools import combinations
import bisect
def mi() : return map(int,sys.stdin.readline().split())
def ii() : return int(sys.stdin.readline().rstrip())
def i() : return sys.stdin.readline().rstrip()
a=ii()
if a%2==0:
  a//=2
  print(a*(a-1))
else:
  b=(a-1)//2
  print(a*b)
N = int(input())

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

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

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

print(ans)
# coding: utf-8
n = int(input())

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

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

if N == 1:
    print(0)
elif N == 2:
    print(1)
else:
    if N % 2 == 1:
        print( (N*(N-1))//2 )
    else:
        print( (N*(N-1))//2 - 1 )
L,R = map(int,input().split())
mn = 10**10
cal = 0
for i in range(L,R+1):
    for j in range(i+1,R+1):
        
        cal = ((i%2019)*(j%2019))%2019
        if cal < mn:
            mn = cal
        if cal == 0:
            break
    else:
        continue
    break
print(mn)
L,R=map(int,input().split())

if R<L+2019:
  end=R
else:
  end=L+2018

ans=2020*2020
for l in range(L,end):
  for r in range(l+1,end+1):
    if ans>(l*r)%2019:
      ans=(l*r)%2019
    if ans==0:
      break
print(ans)
l,r=map(int,input().split())
import sys
mod=2019
ans=float('inf')

for i in range(l,r+1):
  for j in range(i+1,r+1):
    ans=min((i*j)%mod,ans)
    if ans==0:
      print(0)
      sys.exit()
print(ans)
import sys
l,r = map(int,input().split())
mn = 2018
for i in range(l,r+1):
    for j in range(i+1,r+1):
        mod = (i * j) % 2019
        if mod == 0:
            print(0)
            sys.exit()
        
        mn = min(mn,mod)
print(mn)