Problem:
 Score : 400 points    Problem Statement For an integer N , we will choose a permutation \{P_1, P_2, ..., P_N\} of \{1, 2, ..., N\} .  Then, for each i=1,2,...,N , let M_i be the remainder when i is divided by P_i .  Find the maximum possible value of M_1 + M_2 + \cdots + M_N .      Constraints  N is an integer satisfying 1 \leq N \leq 10^9 .         Input Input is given from Standard Input in the following format:  N       Output Print the maximum possible value of M_1 + M_2 + \cdots + M_N .        Sample Input 1 2      Sample Output 1 1  When the permutation \{P_1, P_2\} = \{2, 1\} is chosen, M_1 + M_2 = 1 + 0 = 1 .       Sample Input 2 13      Sample Output 2 78       Sample Input 3 1      Sample Output 3 0

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

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

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

Solution (Python):


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

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

Solution (Python):
n = int(input())

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

print(ans)

Solution (Python):
n=int(input());print(n*(n-1)//2)

Solution (Python):
N = int(input())
ans = (N*(N-1)//2)
print(ans)

Solution (Python):
N=int(input())
M=int((N*(N-1))//2)
print(M)

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

Solution (Python):
N = int(input())
ans = ((N-1)*N)//2
print(ans)

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

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

Solution (Python):
N = int(input())

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

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

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

Solution (Python):
a=int(input())
b=(a-1)*a//2
print(b)

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

Solution (Python):
N = int(input())

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

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

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

Solution (Python):
a=int(input())
print(a*(a-1)//2)

Solution (Python):
N = int(input())

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

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

Solution (Python):
n = int(input())

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

Solution (Python):
def main():

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

if __name__ == "__main__":
    main()

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

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

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

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

Solution (Python):
N = int(input())
nsum = N * (N-1) //2
print(nsum)

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

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

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

Solution (Python):
N = int(input())

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

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

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

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

Solution (Python):
t=int(input())
print(t*(t-1)//2)

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

Solution (Python):


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

Solution (Python):
N=int(input())

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

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

Solution (Python):
n = int(input())
first, last = 1, n-1
res = (n-1)*n//2
print(int(res))

Solution (Python):


n = int(input())

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

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

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

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

Solution (Python):




num = int(input())


rtn = num * (num-1) //2
print(int(rtn))

Solution (Python):
n=int(input());print((n-1)*n//2)

Solution (Python):
N = int(input())

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

Solution (Python):
n = int(input())

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

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

Solution (Python):
n = int(input())
print((n-1 + 1) * (n-1) // 2)

Solution (Python):
a = int(input())
s = a*(a-1)//2
print(s)

Solution (Python):
a = int(input())
s = a*(a-1)//2
print(s)

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

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

Solution (Python):
a = int(input())
ans = a*(a-1)//2
print(int(ans))

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

Solution (Python):
n = int(input().strip())

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

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

Solution (Python):
import math
n = int(input())

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

Solution (Python):
n = int(input())

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

Solution (Python):


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

Solution (Python):
n = int(input())

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

Solution (Python):


MOD = 10 ** 9 + 7

N = int(input())

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

print(ans)

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

Solution (Python):
N = int(input())

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

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

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

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

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

Solution (Python):


N = int(input())

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

Solution (Python):
def slove():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    t = 0
    for i in range(1, n):
        t += i
    print(t)


if __name__ == '__main__':
    slove()

Solution (Python):
N = [int(s) for s in raw_input().split(" ")][0]
print(N * (N-1) / 2)

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

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

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

Solution (Python):
N = int(input())

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

print(ans)

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

Solution (Python):
N=int(input())
a=(1+N-1)*(N-1)//2
print(a)

Solution (Python):


N=int(input())

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

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

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

Solution (Python):
N = int(input())

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

Solution (Python):
n = int(input())
s = n * (n-1)//2
print(s)

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

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

Solution (Python):
while True:
    try:
        N = int(input())
        print(N*(N-1)//2)
    except EOFError:
        break

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

Solution (Python):

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

Solution (Python):
a = int(input())

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

Solution (Python):
N = int(input())
ans = 0
N -= 1

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

print(ans)

Solution (Python):
n = int(input())

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

Solution (Python):
N = int(input())

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

Solution (Python):

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


n = int(input())
r = calc(n)
print(r)

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

Solution (Python):
N = int(input())

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

Solution (Python):
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations
import sys
import string
from bisect import bisect_left


INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LIM(): return list(map(lambda x:int(x) - 1, sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def LIRM(n): return [LIM() 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)]
def SRL(n): return [list(S()) for i in range(n)]
mod = 1000000007


print(sum(range(I())))

Solution (Python):
def read_input():
	N = int(raw_input())
	return N

def f(N):
	return N*(N-1)/2





N = read_input()
print f(N)

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

Solution (Python):
N = int(input())

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

Solution (Python):


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


if __name__ == "__main__":
    main()

Solution (Python):
n = int(input()) - 1
print(int(n*(n+1)//2))

Solution (Python):
N = int(input())

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

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

Solution (Python):
N = int(input())

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

print(res)

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

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

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

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

Solution (Python):

N = int(input())

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

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

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

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

Solution (Python):
N=int(input())
m=0
if N==1:
  m=0
elif N==2:
  m=1
elif N>=3:
  m=(1+(N-1))*(N-1)//2
print(m)

Solution (Python):
N=int(input());print(N*(N-1)//2)

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

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

Solution (Python):
n = int(input())

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

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

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

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

Solution (Python):
n = int(input())

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

Solution (Python):
N = int(input())

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

Solution (Python):


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

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

Solution (Python):
n = int(input())
c = 0    
an = (n-1)*n//2
print(round(an))

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

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

Solution (Python):
n = int(input())
a = (n - 1) * n // 2
print(int(a))

Solution (Python):
N = int(input())

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

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

Solution (Python):

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

Solution (Python):
def solve(n):
    return (n-1) * n // 2

n = int(input())
print(solve(n))

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

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

Solution (Python):
def summention(n):
    return n*(n+1)//2

n = int(input())
print(summention(n-1))

Solution (Python):
n = int(input())
print(n*(n+1) // 2  - (n + 1) + 1)

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

Solution (Python):
num = int(input())
result = num * (num - 1) // 2

print(int(result))

Solution (Python):
def main():
    N = int(input())
    print((N*(N-1)//2))
    
if __name__ == "__main__":
    main()

Solution (Python):
N = int(input())
max = 0


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

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

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

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

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

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

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

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

Solution (Python):
N = int(input())

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

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

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

Solution (Python):
n=int(input());print(n*(n-1)//2)

Solution (Python):


n = int(input())
count = (n - 1) * n // 2
print("{}".format(count))

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

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

Solution (Python):
size = int(input().rstrip("\n"))
print(size * (size-1) // 2)

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

Solution (Python):
N = int(input())
result = int(N*(N-1)//2)

print(result)

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

Solution (Python):
N = int(input())
SUM = N*(N-1)//2
print(SUM)

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

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

Solution (Python):
print((lambda x: (x*(x-1))//2)(int(input())))

Solution (Python):
n = int(input())
if n%2==0:
  k = n//2
  ans = k*(2*k-1)
else:
  k = n//2
  ans = k*(2*k+1)

print(ans)

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

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

Solution (Python):
import numpy as np

a = int(input())
answer = a*(a-1)//2

print(int(answer))

Solution (Python):
n = int(input())

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

Solution (Python):
N = int(input())




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

print(ans)

Solution (Python):
n = int(input())

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

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

Solution (Python):
n = int(input())

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

Solution (Python):
n=int(input())
ans=(n*n-n)//2
print(ans)

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

Solution (Python):
N = int(input().rstrip())

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

Solution (Python):
n=int(input());print(n*(n-1)//2)

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

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

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

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

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

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

Solution (Python):
n = int(input())

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

Solution (Python):
n = int(input())

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

Solution (Python):
N = int(input())

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

print(ans)

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

main()

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

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

Solution (Python):
n = (int)(input())
k = n*(n-1)//2
print(k)

Solution (Python):
n = int(input())
t = n - 1
ans = (1 + t) * t // 2
print(ans)

Solution (Python):
N = int(input()) - 1

print("{}".format(N*(N+1)//2))

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

Solution (Python):
n=int(input())
print(n*~-n//2)

Solution (Python):
n=int(input())
print(n*~-n//2)

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

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

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

Solution (Python):
n = int(input())

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

print (ans)

Solution (Python):
n=int(input())

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

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

Solution (Python):
N = int(input())

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

Solution (Python):
n = int(input())

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

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

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

Solution (Python):
N = int(input())

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

Solution (Python):
n = int(input())


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

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

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

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

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

Solution (Python):
a = int(input())
print((a*(a-1))//2)

Solution (Python):
n = int(input().strip())
print(((n-1)*n)//2)

Solution (Python):
n = int(input())
ans = 0
ans = (pow(n,2) - n) // 2
print(ans)

Solution (Python):
N = int(input())
ans = N*(N-1)//2
print(ans)

Solution (Python):

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

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

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

Solution (Python):
n=int(input())
print((n-1)*(n-2)//2+(n-1))

Solution (Python):
n = int(input())

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

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

Solution (Python):
n= int(input())
m =int( n * (n-1) //2)
print(m)

Solution (Python):
a = int(input())
print((a*(a-1))//2)

Solution (Python):
def solve(string):
    n = int(string)
    return str(n * (n - 1) // 2)


if __name__ == '__main__':
    print(solve(input()))

Solution (Python):
n = int(raw_input())
print n*(n-1)/2

Solution (Python):




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

Solution (Python):
N = int(input())

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

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

Solution (Python):
num = int(input())
print(int(num * (num -1) // 2))

Solution (Python):
from collections import Counter,defaultdict
import sys,heapq,bisect,math,itertools,string,queue,datetime
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

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

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

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

Solution (Python):
n=int(input())


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

Solution (Python):
n = int(input())
ans = 0
ans = (1 + n-1)*(n-1)//2
if n == 1:
    ans = 0
print(ans)

Solution (Python):
N = int(input())
ans = N * (N-1) // 2
print(ans)

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

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

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

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

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

Solution (Python):
S=int(input())

ans=(S-1)*S//2
print(ans)

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

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

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

Solution (Python):
n=int(input())
n-=1
print(((n)*(n+1))//2)

Solution (Python):
A = raw_input()
A = int(A)

print A * (A-1) / 2

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

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

Solution (Python):
n=int(input());print(n*~-n//2)

Solution (Python):
N = int(input())
ans = N*(N-1) // 2
print(ans)

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

Solution (Python):
n = int(input())

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

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

Solution (Python):
n = int(input())
s = n*(n-1)//2
print(s)

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

Solution (Python):
n=int(input())-1
print(n*(n+1)//2)

Solution (Python):
N = int(input())

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

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

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

Solution (Python):
n = int(input())

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

print(ans)

Solution (Python):



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


if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())


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

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

Solution (Python):
from decimal import Decimal
n=int(input())

a=Decimal(n)*Decimal((n-1))/Decimal(2)

print(int(Decimal(a)))

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

Solution (Python):
N = int(input())

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

Solution (Python):
N = int(input())

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

print(ans)

Solution (Python):
n = int(input())

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

Solution (Python):
import sys
def input():
    return sys.stdin.readline().rstrip()

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

print(s)

Solution (Python):
n = int(input())
n = n-1
res = n*(n+1)
res = res//2

print(res)

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

Solution (Python):
n=int(input());print(n*(n-1)//2)

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

Solution (Python):
N = int(input())

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

print(ans)

Solution (Python):
N = int(input())

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

print(ans)

Solution (Python):
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
import math
import queue


Mod = 1000000007
 
  
def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))+1):
        if prime[i] == 1:
            for j in range(2*i,n+1):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n+1):
        if prime[i] == 1:
            res.append(i)
    return res

def factorial(i):
    if i == 1:
        return 1
    else:
        return i*factorial(i-1)
 
class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py
 
    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)




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

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

Solution (Python):
from collections import Counter, defaultdict
import sys
sys.setrecursionlimit(10 ** 5 + 10)

from math import factorial
import heapq, bisect
import math
import itertools





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




if __name__ == '__main__':
    main()

Solution (Python):
from sys import exit, stderr, stdin
input = stdin.readline


def debug(var, name="hoge"):
    print(name +":" + str(type(var)) + " = " + repr(var), file=stderr)
    return

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

def main():
    N = int(input())
    if (N==1):
        print(0)
    else:
        print(gau(N-1))

if __name__ == "__main__":
    main()

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

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

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

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

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

Solution (Python):
a = int(input())-1
a = (a+1)*a//2
print(a)

Solution (Python):
a = int(input())-1
a = (a+1)*a//2
print(a)

Solution (Python):
N = int(input())

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

Solution (Python):
n=int(input())
k=n*(n-1)//2
print(k)

Solution (Python):
N = int(input())
ans = (N * (N - 1)) // 2
print(ans)

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

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

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

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

Solution (Python):
n = int(input())
tmp = n*(n-1)
print(tmp/2)

Solution (Python):
n = int(input())
tmp = n*(n-1)
print(tmp//2)

Solution (Python):
from decimal import *
N = int(input())
print(int((Decimal(N-1)*Decimal(N))/Decimal(2)))

Solution (Python):
import sys
input = sys.stdin.readline

N = int(input())

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

Solution (Python):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

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

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

Solution (Python):


import sys
import copy
import math

sys.setrecursionlimit(1000000)





N = int(input())

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

print(ans)

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

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

Solution (Python):
n = int(input())
ans = (2 + (n - 1)) * (n - 2) // 2
if n == 2:
    ans = 1
else:
    ans += 1
print(ans)

Solution (Python):
N = int(input())
ans = N*(N-1)//2
print(ans)

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

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

Solution (Python):
print(*[n*(n-1)//2 for n in [int(input())]])

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

Solution (Python):
N = int(input())
M = N*(N-1)//2
print(M)

Solution (Python):
N = int(input())

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

Solution (Python):





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

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

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

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

Solution (Python):


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

    

    """
    i   = 1 2 3 4 5 6 7 8
    P_i = 2 3 4 5 6 7 8 1

    ↑これが最大値なのでは？
    つまり、
    ・P_i = i + 1
    ・P_N = 1
    にすると、1 ~ N-1の和が答えになる。
    """
    ans = (1+(N-1))*(N-1)//2
    print(ans)

if __name__ == "__main__":
    solve()

Solution (Python):
n=int(input())
n-=1
f=(n*(n+1))//2
print(f)

Solution (Python):
n = int(input())
sum = n*(n-1)//2
print(sum)

Solution (Python):
N = int(input())

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

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

Solution (Python):
limit=int(input())
sum=((limit-1)*limit//2)
print(sum)

Solution (Python):
limit=int(input())
sum=((limit-1)*limit//2)
print(sum)

Solution (Python):
def solve(N):
    return N * (N - 1) // 2



if __name__ == '__main__':
    N = int(input())
    ans = solve(N)
    print(ans)

Solution (Python):
N = int(input())

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

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

Solution (Python):
def d():
    n = int(input())
    print(n * (n - 1) // 2)


if __name__ == '__main__':
    d()

Solution (Python):
N=int(input())
ans=N*(N-1)//2
print(ans)

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

Solution (Python):
from decimal import Decimal
N = int(input())
print(int(Decimal(1/2) * Decimal(N) * Decimal(N - 1)))

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

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

Solution (Python):
N = int(input())
 
ans = N * (N-1) // 2
print(int(ans))

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

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

Solution (Python):
N = int(input())

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

Solution (Python):
from decimal import Decimal
N = int(input())
print(Decimal(N * (N - 1) // 2))

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

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

Solution (Python):
N=int(input());print(N*(N-1)//2)

Solution (Python):
N = int(input())

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

Solution (Python):
N = int(input())

M = 0

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


print(int(M))

Solution (Python):
N = int(input())

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

Solution (Python):
N = int(input())
ans=(N*(N-1))//2
  
print(int(ans))

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

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

Solution (Python):
n=int(input())
print(int((n**2-n)//2))

Solution (Python):
n=int(input())
print((n**2-n)//2)

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

Solution (Python):
import sys
import math
from fractions import gcd





def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""


 =  sys.stdin.readline().rstrip()
 =  list(sys.stdin.readline().rstrip())


 =  int(sys.stdin.readline())
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""
n=  int(sys.stdin.readline())
if n ==1:
    print(0)
elif n == 2:
    print(1)
else:
    print(n*(n-1)//2)

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

Solution (Python):
x=int(input())
print(x*(x-1)//2)

Solution (Python):
import math
n = int(input())
print(math.floor(((n-1)*(n-1+1))//2))

Solution (Python):
def main():
  n = int(input())
  if n == 1:
    print(0)
    return
  if n == 2:
    print(1)
    return
  
  print(n*(n-1)//2)

main()

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

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

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

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

Solution (Python):
def resolve():
    N = int(input())
    ans = (N-1)*N//2
    print(ans)
resolve()

Solution (Python):
import itertools
N = int(input())
print (N*(N-1)//2)

Solution (Python):
a = int(input())
print(((a)*(a-1))//2)

Solution (Python):
n=int(input());print(n*~-n//2)

Solution (Python):
n=int(input());print(n*(n-1)//2)

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

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

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

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

Solution (Python):
n = int(raw_input())
print (n*(n-1))/2

Solution (Python):
n=int(input())
print(n*(n+1)//2-n)

Solution (Python):
i = int(input())
print(i*(i-1)//2)

Solution (Python):
N = int(input())
ans = (N * (N-1))//2
print(ans)

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

Solution (Python):

N = int(input())

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

Solution (Python):
import sys

ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: [int(x) for x in ns().split()]
nall = lambda: [int(x) for x in sys.stdin.readlines()]


def main():
    n = ni()

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


if __name__ == '__main__':
    main()

Solution (Python):

N = int(input())

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

Solution (Python):
n=int(input())
n-=1
a=(n*(n+1))//2
print(a)

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

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

Solution (Python):
from heapq import heappush, heappop
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations
import sys
import bisect
import string
sys.setrecursionlimit(10**6)
def SI():
    return input().split()
def MI():
    return map(int,input().split())
def I():
    return int(input())
def LI():
    return [int(i) for i in input().split()]
YN=['Yes','No']
mo=10**9+7

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

Solution (Python):
n=int(input())

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

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

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

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

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

Solution (Python):
n = int(input()) - 1
print((1 + n) * n // 2)

Solution (Python):
from decimal import Decimal
n = int(input())
ans = int((n / Decimal(2)) * (n - 1))
print(ans)

Solution (Python):
m = int(input())

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

Solution (Python):
n = int(input())
if n==1:
  b = 0
else:
  b = (n*(n-1))//2
  
print(b)

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

Solution (Python):
N = int(input())
output = ((N - 1) * N) // 2
 
print(int(output))

Solution (Python):
n = int(input())
x=0
c=n
x=((n*(n-1))//2)
print(x)

Solution (Python):

N = int(raw_input())

print N*(N-1)//2

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

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

Solution (Python):
n = int(input())
sn = ((n-2)*(2+(n-1)))//2+max(n%2,1%2)
print(sn)

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