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):
import collections
import math
import operator as op
from functools import reduce
import numpy as np
import math
import bisect
import heapq


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


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


def get_inputs(cast_func=None):
    if cast_func is None:
        return input().split()
    else:
        return list(map(cast_func, input().split()))


def get_input(cast_func=None):
    if cast_func is None:
        return input()
    else:
        return cast_func(input())


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


if __name__ == '__main__':
    main()

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

Solution (Python):
n = int(input().strip())
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(ans)

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

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

Solution (Python):
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
def resolve():
    n=int(input())
    print(n*(n-1)//2)
resolve()

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


if __name__ == '__main__':
    main()

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

Solution (Python):
n=int(input())-1
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().rstrip()

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

if __name__ == '__main__':
    main()

Solution (Python):
import sys
sys.setrecursionlimit(10**6)
if sys.platform in (['ios','darwin','win32']):
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return [int(s) for s in input().split()]

def main():
	N = INT()
	M = N-1
	ans = (1+M)*M//2
	print(ans)

if __name__ == '__main__':
	main()

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 sys
input = sys.stdin.readline

n = int(input())

from decimal import Decimal
ret = Decimal(n/2)*Decimal(n-1)
print(int(ret))

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

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

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

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

Solution (Python):
from collections import defaultdict,deque, Counter
import sys,heapq,bisect,math,itertools,string,queue,copy,time
import numpy as np
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-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())
ans = 0

n = inp()
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
input = sys.stdin.readline

n = int(input())

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

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

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

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

Solution (Python):

N = int(input())

calc_N =  N-1

if calc_N % 2 == 1:
    O = calc_N // 2
    output = (1+calc_N) * O + O + 1
else :
    O = calc_N // 2
    output = (1+calc_N) * O
    
print(output)

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


if __name__ == '__main__':
    solve()

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

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

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

Solution (Python):

import math
import heapq
import bisect

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):
def calculate(n):
    return n * (n-1) // 2

N = int(input())
print(calculate(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())

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

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

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

Solution (Python):

N = int(input())

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

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

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

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














def main():
    n = int(sys.stdin.readline().rstrip())
    ans = (1 + (n - 1)) * (n - 1) // 2
    print(ans)
if __name__ == "__main__":
    main()

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

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

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

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

print(m)

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

Solution (Python):

import sys, math
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
ans=count=0

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

Solution (Python):
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools
sys.setrecursionlimit(10**8)
mod = 10**9+7
mod2 = 998244353
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

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

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

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

else:
    sum = int((n-1)/2)
    sum = sum * n

print(int(sum))

Solution (Python):
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b



def sum_of_arithmetic_progression(s, d, n):
    return n * (2 * s + (n - 1) * d) // 2



def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)



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


def main():
    N = int(input())
    print(sum_of_arithmetic_progression(1, 1, N - 1))


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

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

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

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

print(ans)

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

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

Solution (Python):
import sys
import math
import bisect
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop


def LI(): return [int(x) for x in sys.stdin.readline().split()]


def I(): return int(sys.stdin.readline())


def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res


def IR(n):
    return [I() for i in range(n)]



def A():
    s = S()
    t = S()
    ans = 0
    for i in range(3):
        if s[i] == t[i]:
            ans += 1
    print(ans)
    return



def B():
    a, b = LI()
    print(-(-(b - 1) // (a - 1)))
    return



def C():
    N = I()
    H = LI()
    ans = 0
    cnt = 0
    for i in range(1, N):
        if H[i - 1] >= H[i]:
            cnt += 1
            ans = max(ans, cnt)
        else:
            cnt = 0
    print(ans)
    return



def D():
    N = I()
    print(N * (N - 1) // 2)
    return



def E():
    return



def F():
    return



def resolve():
    D()
    return



if __name__ == "__main__":
    D()

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

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

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

wa = (n+1)*(n//2)
if n % 2 == 1:
    wa+=(n+1)//2

print(wa-n)

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

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

Solution (Python):
print(sum(range(int(input()))))

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

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

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

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

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

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

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

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

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

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

Solution (Python):

import sys


def solve(N: int):
    answer = (N-1)*N//2
    print(answer)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    solve(N)

if __name__ == '__main__':
    main()

Solution (Python):
import sys
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
mod = 10**9 + 7
inf = float('inf')

N = I()
ans = int(0)

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

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

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

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

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

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

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

Solution (Python):
import sys


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    n = int(input().rstrip('\n'))
    print((n-1) * (1 + n - 1) // 2)


if __name__ == '__main__':
    solve()

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

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

Solution (Python):
def pa(an):
	return (an)*(an+1) //2

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

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

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

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

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

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

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

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

print(int((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())
ans = sum(range(N))
print(ans)

Solution (Python):
from sys import stdin

n = int(stdin.readline().rstrip())
point = n*(n-1)//2
print(point)

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

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

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

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

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

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

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

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy,copy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect_left 

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

def main():
    n = INT()

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

if  __name__=='__main__':
    main()

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

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

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

print(ans)

Solution (Python):
N = int(input())
if N == 1:
    print(0)

elif N == 2:
    print(1)

else:
    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*(N-1)//2)

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

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

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

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(read())

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

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

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

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

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


if __name__ == "__main__":
    main()

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

Solution (Python):



N = int(input())


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

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

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

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

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

a = int(input())

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

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




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

Solution (Python):
from sys import stdin
n = int(stdin.readline().rstrip())
ans = (n*(n-1))/2
print(ans)

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

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

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

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

Solution (Python):

import sys




args = sys.argv
if len(args) == 2:
  from IPython import embed
  em = True
else:
  em = False




N = int(input())







if em: sys.stdin = open('/dev/tty')






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

Solution (Python):

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


if __name__ == "__main__":
    main()

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

N -= 1

print('%d' % (N * (N + 1) // 2))

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

sys.setrecursionlimit(10 ** 7)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x) - 1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())


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

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

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

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

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

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

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

n-=1

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

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

Solution (Python):




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

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

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

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

if __name__ == '__main__':
    solve()

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


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

Solution (Python):
import numpy as np
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):


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

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

Solution (Python):


import sys,collections,itertools,re,math,fractions,decimal,random,array,bisect,heapq





def solve(f):
    n = f.read_int()
    return n*(n-1)/2


class Reader(object):
    def __init__(self, filename=None):
        self.file = open(filename) if filename is not None else None
        self.case = 1

    def __readline(self):
        return self.file.next().strip() if self.file else raw_input()

    def next_case(self):
        self.file.next()
        self.case += 1

    def read_int(self): return int(self.__readline())
    def read_float(self): return float(self.__readline())
    def read_long(self): return long(self.__readline())
    def read_decimal(self): return decimal.Decimal(self.__readline())
    def read_str(self): return self.__readline()

    def read_int_list(self): return map(int, self.__readline().split())
    def read_float_list(self): return map(float, self.__readline().split())
    def read_long_list(self): return map(long, self.__readline().split())
    def read_decimal_list(self): return map(decimal.Decimal, self.__readline().split())
    def read_str_list(self): return self.__readline().split()

if __name__ == '__main__':
    filename = sys.argv[1] if len(sys.argv) > 1 else None
    f = Reader(filename)
    if f.file:
        while True:
            print "Case 
            try:
                f.next_case()
            except StopIteration:
                break
    else:
        print solve(f)

Solution (Python):

from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')


def A():
    s = S()
    t = S()
    ans = 0
    for i in range(3):
        if s[i] == t[i]:
            ans += 1
    print(ans)
    return


def B():
    a, b = LI()
    ans = 0
    b -= 1
    while b > 0:
        b -= a - 1
        ans += 1
    print(ans)

    return


def C():
    n = II()
    h = LI()
    i = 0
    ans = 0
    while i < n:
        down = i+1
        while down < n:
            if h[down - 1] >= h[down]:
                down += 1
            else:
                break
        ans = max(ans, down - i - 1)
        i = down
    print(ans)
    return


def D():
    n = II()
    print(n * (n - 1) // 2)
    return


def E():
    return


def F():
    return


if __name__ == '__main__':
    D()

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

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

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

print(ans)

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

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-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):
s=input()
a=int(s)
b=0
if a==1:
  print(0)
else:
  b=((a-1)*a)//2
  print(b)

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

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

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

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

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

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


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

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

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

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

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


if __name__ == "__main__":
    main()

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

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

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

Solution (Python):
from itertools import accumulate


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

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

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

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

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

Solution (Python):


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

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

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