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())
ans=0
for i in range(1,n):
  ans+=i
print(ans)

Solution (Python):
import math
from math import gcd,pi,sqrt
INF = float("inf")
MOD = 10**9 + 7

import sys
sys.setrecursionlimit(10**6)
import itertools
import bisect
from collections import Counter,deque
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]


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


if __name__=="__main__":
    main()

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

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

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

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

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

Solution (Python):


N=int(input())

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

Solution (Python):
import math
import collections
import itertools

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

def resolve():

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

    print(ans//2)

resolve()

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

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

Solution (Python):
import sys









MOD = 10 ** 9 + 7
INF = 10 ** 9
PI = 3.14159265358979323846

def read_str():      return sys.stdin.readline().strip()
def read_int():      return int(sys.stdin.readline().strip())
def read_ints():     return map(int, sys.stdin.readline().strip().split())
def read_ints2(x):   return map(lambda num: int(num) - x, sys.stdin.readline().strip().split())
def read_str_list(): return list(sys.stdin.readline().strip().split())
def read_int_list(): return list(map(int, sys.stdin.readline().strip().split()))
def GCD(a: int, b: int) -> int: return b if a%b==0 else GCD(b, a%b)
def LCM(a: int, b: int) -> int: return (a * b) // GCD(a, b)

def Main():
    n = read_int()
    
    
    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 - N)

Solution (Python):



N = int(input())

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

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

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


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

Solution (Python):
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)

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

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):
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)

Solution (Python):
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  
def LS2(): return list(sys.stdin.readline().rstrip())  


N = I()
print(N*(N-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):
def main():
    N = int(input())
    if N % 2 == 0:
        print((N // 2) * (N-1))
    else:
        print(N * ((N-1)//2))

if __name__ == '__main__':
    main()

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

Solution (Python):
N = int(input())
ans = 0
for i in range(N):
    ans += i
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())
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==1: print(0); exit();
if n==2: print(1); exit();
print(n*(n-1)//2)

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

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

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

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*(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 = (N-1)*N//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())

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

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

Solution (Python):
n=input();print n*(n-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())

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

print(ans)

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

Solution (Python):
def delete_head_zeros(n):
	n = str(n)
	l = len(n)
	if "." in n:
		l = n.find(".")
	head_zeros = 0
	for i in range(l - 1):
		if n[i] == "0":
			head_zeros += 1
		else:
			break

	return n[head_zeros:]



def bigint_compare(a, b):
	a = delete_head_zeros(a)
	b = delete_head_zeros(b)
	if len(a) > len(b):
		return 1
	elif len(a) < len(b):
		return -1
	else:
		if a > b:
			return 1
		elif a < b:
			return -1
		else:
			return 0



def bigint_plus(a, b):
	a = str(a)
	b = str(b)

	d = max([len(a), len(b)])
	a = '0' * (d - len(a)) + a
	b = '0' * (d - len(b)) + b

	ans = ""
	carry = 0
	for i in range(d):
		s = int(a[-i-1]) + int(b[-i-1]) + carry
		carry = s // 10
		ans = str(s % 10) + ans
	else:
		if carry:
			ans = str(carry) + ans

	return ans



def bigint_minus(a, b): 
	a = str(a)
	b = str(b)
	M = []
	m = []
	sign = ""

	if len(a) > len(b) or (len(a) == len(b) and a >= b):
		[M, m] = [a, b]
	else:
		[M, m] = [b, a]
		sign = "-"
	m = '0' * (len(M) - len(m)) + m

	ans = ""
	borrow = 0
	for i in range(len(M)):
		s = int(M[-i-1]) - int(m[-i-1]) - borrow
		if s < 0:
			borrow = 1
			s += 10
		else:
			borrow = 0
		ans = str(s) + ans

	return sign + delete_head_zeros(ans)



def bigint_multiply(a, b):
	a = str(a)
	b = str(b)

	md = []
	for j in range(len(b)):
		carry = 0
		mj = ""
		for i in range(len(a)):
			m = int(a[-i-1]) * int(b[-j-1]) + carry
			carry = m // 10
			mj = str(m % 10) + mj
		else:
			if carry:
				mj = str(carry) + mj
		md.append(mj)

	ans = 0
	for k in range(len(md)):
		ans = bigint_plus(md[k] + "0" * k, ans)

	return ans




def bigint_divide(a, b, d = 0):
	a = str(a)
	b = str(b)
	d = int(d)
	if d < 0:
		d = 0

	ans = ""
	r = ""
	for i in range(len(a) + d):
		q = 0
		if i < len(a):
			r += a[i]
		elif i == len(a):
			ans += "."
			r += "0"
		else:
			r += "0"

		if bigint_compare(r, b) == -1:
			ans += str(q)
		else:
			while bigint_compare(r, b) >= 0:
				r = bigint_minus(r, b)
				q += 1
			ans += str(q)

	return delete_head_zeros(ans)

def main():
	N = input()
	print(
		bigint_divide(
			bigint_multiply(N, bigint_minus(N, 1))
			,2
		)
	)

main()

Solution (Python):
import sys
from collections import deque
from bisect import bisect_left, bisect_right, insort_left, insort_right 
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)

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

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

Solution (Python):
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)

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())

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

print(modsum)

Solution (Python):
def main():
  N = int(input())
  if N==1:
    print(0)
    return
  ans = sum(range(1,N))
  print(ans)
main()

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

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

if __name__ == "__main__":
    main()

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

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

    print(ans)


if __name__ == "__main__":
    main()

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

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

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

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

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

Solution (Python):
import sys
import heapq


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

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

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

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

Solution (Python):
n = int(input())
print(int((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):
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N=I()
    ans=((N)*(N-1))//2
    
    print(ans)

main()

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

Solution (Python):
import sys

input = sys.stdin.readline

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

if __name__ == '__main__':
    main()

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

Solution (Python):
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter,defaultdict
from operator import mul
import copy


import heapq
sys.setrecursionlimit(10**6)

INF = 10**18
import bisect
import statistics
mod = 10**9+7


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

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

Solution (Python):
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


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

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

main()

Solution (Python):
N = int(input())
ans = ((N-1)*N)//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):
import sys


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


if __name__ == "__main__":
    main()

Solution (Python):








def solve(N):
    n = N - 1
    print((n + 1) * n // 2)


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

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

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

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

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

print(ans)

Solution (Python):
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():
    n = I()
    n -= 1
    ans = n*(n+1) //2
    print(ans)


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())

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

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

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

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

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

Solution (Python):




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

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

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

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

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

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

print(ans)

Solution (Python):
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())

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

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



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

print(ans)

Solution (Python):
import sys


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

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

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

print(int(answer))

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

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

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

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

Solution (Python):
n = int(input())
n = n-1
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-1)*n//2
print(ans)

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

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())

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

print(ans)

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

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

print(ans)

Solution (Python):
from sys import stdin

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

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):
s=0
for i in range(1,int(input())):
    s+=i
print(s)

Solution (Python):
import bisect,collections,copy,heapq,itertools,math,string
from collections import defaultdict as D
from functools import reduce
import numpy as np
import sys
import os
from operator import mul

sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(_S())
def LS(): return list(_S().split())
def LI(): return list(map(int,LS()))

if os.getenv("LOCAL"):
    inputFile = basename_without_ext = os.path.splitext(os.path.basename(__file__))[0]+'.txt'
    sys.stdin = open(inputFile, "r")
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7


N = I()



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

print(ans)

Solution (Python):
from decimal import *

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

print(int(ans))

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

if N == 1:
    print(0)

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

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

Solution (Python):
n=int(input())
ans = (n-1)*(n)//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()) - 1
print(n * (n + 1) // 2)

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

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

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())

if (n-1)%2 == 0:
    print((n*(n-1)//2))
else:
    print(n*(n-2)//2 + 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())
ans = 0
print(((n-1)*(1+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-1)*N//2)

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

Solution (Python):
n = int(input())
ans = (n+1) * (n//2) - n
if n%2 == 1:
    ans += 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):
N = int(input())
ans = N * (N - 1) // 2
print(ans)

Solution (Python):
N = int(input())
ans = sum(range(1, N))
print(ans)

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

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

N = int(readline())



def calc(A):
  return ((1 + A) * A) // 2

print(calc(N - 1))

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

Solution (Python):
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


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



if __name__ == '__main__':
    main()

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

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

print(m)

Solution (Python):
N=int(input())
ans=(N-1)*N//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)


if __name__ == '__main__':
    main()

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

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

print(int(result))

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

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):
x = int(input())

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

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


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


if __name__ == "__main__":
    main()

Solution (Python):
n = int(input())
"""求める最大の余りの合計は1〜N-1の合計に等しい"""
result = n*(n-1)//2
print(result)

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

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

print(int(ans))

Solution (Python):
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
	
	n = int(input())
	ans = (n-1)*(n)//2
	print(ans)

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

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

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

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

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

Solution (Python):

n = int(input())

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

Solution (Python):
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((n-1)*n//2))


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

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

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

Solution (Python):


N = int(input())

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

print(ans)

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

if __name__ == '__main__':
    main()

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

Solution (Python):
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)

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

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

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

ans = 0

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

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 main():
    import sys

    def input(): return sys.stdin.readline().rstrip()
    
    n = int(input())
    print((n-1)*n//2)




if __name__ == '__main__':
    main()

Solution (Python):
import math
N = int(input())
print((N*(N-1)+2)//2-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())
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):
import sys
input=sys.stdin.readline

N=int(input().rstrip('\n'))
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):
import sys

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def main():
    n = I()
    if n == 1:
        print(0)
        sys.exit()
    ans = (n*(n-1))//2
    print(ans)

if __name__ == '__main__':
    main()

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

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

print(ans)

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

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

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

Solution (Python):







__giturl__ = "$URL$"


from sys import stdin
input = stdin.readline


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

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








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

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

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

    
    

    

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

if __name__ == '__main__':
    main()

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


if __name__ == '__main__':
    main()

Solution (Python):

import sys
import re
from collections import deque, defaultdict
from itertools import combinations, combinations_with_replacement
import bisect
from math import factorial, sqrt, log, ceil, floor
sys.setrecursionlimit(1000000)


def main():
    input = sys.stdin.readline
    
    
    

    N = int(input())

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


if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
print((1 + n - 1) * (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 = 0
for i in range(n):
    ans += i
print(ans)

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

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

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

print(ans)

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



if '__main__' == __name__:
    resolve()

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

print(ans)

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

print(ans)

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

Solution (Python):
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def s(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
count = 0
ans = 0
inf = float("inf")

n = k()
if n== 1:
    print(0)
    sys.exit()

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

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

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

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

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

Solution (Python):
import bisect

n = int(input())

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

print(count)

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(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):



from math import *
from copy import *					
from heapq import *					
from string import *				
from random import *				
from bisect import *				
from sys import stdin				
from sys import maxsize				
from operator import *				
from itertools import *				
from decimal import Decimal 		
from collections import Counter		
from collections import defaultdict 

'''
13
'''

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

N = int(stdin.readline())
ans = solve(N)
print(ans)

Solution (Python):
import sys
from collections import deque
import itertools
from collections import deque
sys.setrecursionlimit(10 ** 9)




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


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




if __name__ == "__main__":
    main()