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 sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

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

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



sys.setrecursionlimit(1000000000)

MIN = -10 ** 9
MOD = 10 ** 9 + 7


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

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

i  = lambda: int(input())

N = i()

print((N-1) * N // 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):
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

def s(generator, splitter, mapper):
    return [ mapper(s) for s in generator().split(splitter) ]


def get_nums_l():
    return [ int(s) for s in input().split(" ")]


def get_nums_n(n):
    return [ int(input()) for _ in range(n)]

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




 
from collections import* 
from fractions import gcd
from functools import* 
from itertools import* 
from operator import mul,itemgetter
from bisect import* 
from heapq import* 
from math import factorial,pi
from copy import deepcopy
import sys
sys.setrecursionlimit(10**8)

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

if __name__ == '__main__':
    main()

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

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

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

Solution (Python):
from sys import stdin,stdout
I = lambda : map(int,stdin.readline().split())
import math

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

Solution (Python):
from sys import stdin

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

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

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

if __name__ == "__main__":
    main()

Solution (Python):
import sys

N = int(input())

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

print(wa)

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

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

Solution (Python):
words = lambda t : list(map(t, input().split()))
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):
import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return sys.stdin.readline().strip()
INF = 10 ** 18
MOD = 10 ** 9 + 7

def main(): 
    N = II()

    if N == 1:
        print(0)
        return
    else:
        print(sum(range(N)))
        return

main()

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

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

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

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


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

Solution (Python):
import sys


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



if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
	else:
		pass
		
			
	ret = main()
	if ret is not None:
		print(ret)

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

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

Solution (Python):

import sys
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = lambda *something : print(*something) if DEBUG else 0
DEBUG = False
def main(given = sys.stdin.readline):
    input = lambda : given().rstrip()
    LMIIS = lambda : list(map(int,input().split()))
    II = lambda : int(input())
    XLMIIS = lambda x : [LMIIS() for _ in range(x)]


    N = II()
    print(sum(range(N)))

if __name__ == '__main__':
    main()

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

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

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

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

ans = int(0)

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

print(ans)

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

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

Solution (Python):


import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7


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

N = INT()

print(get_sum(N-1))

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

Solution (Python):

import sys


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

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

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

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

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

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

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

if __name__ == '__main__':
    Solution().main()

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

N = int(input())

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

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

Solution (Python):
import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return sys.stdin.readline().strip()
INF = 10 ** 18
MOD = 10 ** 9 + 7

debug = True
debug = False

def dprint(*objects):
    if debug == True:
        print(*objects)


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

solve()

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

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

print(ans)

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

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

Solution (Python):

def solve():
    N = int(input())
    res = N*(N-1)//2
    return str(res)

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

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

Solution (Python):
import sys
def input():
    return sys.stdin.readline()[:-1]

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

if __name__=='__main__':
    code()

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

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

Solution (Python):

n = int(input())

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

Solution (Python):

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

Solution (Python):

from sys import stdin




def _li(): return list(map(int, stdin.readline().split()))
def _li_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def _lf(): return list(map(float, stdin.readline().split()))
def _ls(): return stdin.readline().split()
def _i(): return int(stdin.readline())
def _f(): return float(stdin.readline())
def _s(): return stdin.readline()[:-1]


N = _i()

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

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

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

Solution (Python):

N=int(input())
print(sum(range(N)))

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

Solution (Python):

from __future__ import division, print_function

import os
import sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip


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

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




BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")



if __name__ == "__main__":
    main()

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

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


if __name__ == "__main__":
    main()

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

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

Solution (Python):
n = int(input())
if(n == 1):
    print(0)
elif(n == 2):
    print(1)
else:
    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):
import sys
input = sys.stdin.readline

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

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

"""
Created on Sun Sep  1 20:24:52 2019

@author: Yamazaki Kenichi
"""

N = int(input())

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

print(ans)

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

Solution (Python):
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools, os, pdb
sys.setrecursionlimit(10**7)
from fractions import Fraction
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def _I(): return int(sys.stdin.readline())
def _F(): return float(sys.stdin.readline())
def _pf(s): return print(s, flush=True)
def perr(s): return print(s, file=sys.stderr)

N = _I()

"""
並び替えた後あまりを計算する
まずは貪欲的に考える
大きい方からあまりが最大になるものをマッチングする
しかしこれだと10**9なので絶対間に合わない
gcdとかいきてきそう
そもそもあまりが
1,2,...Nを割っていく
Nを割ってN余ることはない。
8 % 9は8になる。
ひとつずつずらしていくか
そうすると、1/2n n+1がなりたつ
"""

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

Solution (Python):
import sys

def input(): return sys.stdin.readline()[:-1]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def MATINT(h): return [list(map(int, input().split())) for _ in range(h)]
def MATSTR(h): return [input() for _ in range(h)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
inf = float('inf')
mod = 10 ** 9 + 7

def main():
    N = INT()
    count = 0
    for nn in range(1, N):
        count += nn
    print(count)

if __name__ == '__main__':
    main()

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

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 6)

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

main()

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

Solution (Python):



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

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

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

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


if __name__ == '__main__':
    main()

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

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):
''' بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ '''

gi = lambda : list(map(int,input().split()))
n, = gi()
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):
a=int(input())
print(a*(a-1)//2)

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

t = N - 1

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

Solution (Python):
n=int(input())
print(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):
import sys
def input():
    return sys.stdin.readline()[:-1]
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())
print(N*(N-1)//2)

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

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

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

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

Solution (Python):
def solve():
    n = read()
    result = think(n)
    write(result)


def read():
    return read_int(1)[0]


def read_int(n):
    return list(map(lambda x: int(x), read_line().split(' ')))[:n]


def read_float(n):
    return list(map(lambda x: float(x), read_line().split(' ')))[:n]


def read_line(n=0):
    if n == 0:
        return input().rstrip()
    else:
        return input().rstrip()[:n]


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


def write(result):
    print(result)


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

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

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

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

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

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

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

Solution (Python):



import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline



n = int(input())


"""
L = list(range(1,n+1))
ans = 0
for i in permutations(L):
    res = 0
    for j in range(n):
        res += (j+1)%i[j]
    ans = max(ans,res)    
"""

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

Solution (Python):
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
mod = 10**9+7
Max = sys.maxsize
def l(): 
    return list(map(int,input().split()))
def m(): 
    return map(int,input().split())
def onem(): 
    return int(input())
def s(x): 
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): 
    return " ".join(map(str,x))
def max2(x): 
    return max(map(max,x))
def In(x,a): 
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

n = onem()


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

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

Solution (Python):
"""
N = int(input())
A, B = map(int,input().split())
lst = [list(map(int,input().split())) for i in range(M)]
A = list(map(int,input().split()))
"""

N = int(input())

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

Solution (Python):
def li():
    return list(map(int, input().split()))


if __name__ == "__main__":
    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-N)

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

n = N - 1

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

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

print(sum(range(1, N + 1)) - N)

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

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

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

Solution (Python):


N = int(input())

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

Solution (Python):

import sys
INF = float("inf")


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

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

Solution (Python):
import sys
from heapq import heappop, heappush
from operator import itemgetter
from collections import deque, defaultdict, Counter
from bisect import bisect_left, bisect_right
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
MOD = 10**9 + 7
INF = float('inf')

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

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

    print(ans)

sol()

Solution (Python):
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))



def main():
    n = ii()
    
    if n == 1:
        print(0)
    elif n == 2:
        print(1)
    else:
        ans = (n*(n-1))//2
        print(ans)
main()

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

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

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

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

Solution (Python):

N = int(input())

m = N-1

print ((1+m) * m // 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
sys.setrecursionlimit(10000000)
def input():
    return sys.stdin.readline()[:-1]
from collections import *
import math
from bisect import *
import functools
INF = float('inf')
mod = 10**9+7

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

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

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

Solution (Python):


import itertools
from collections import Counter
from collections import defaultdict
from collections import deque
import bisect
from heapq import heappush, heappop

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):
def getlist():
	return list(map(int, input().split()))

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

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

Solution (Python):

import sys
sys.setrecursionlimit(300000)


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

from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
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 LIR(n):
    return [LI() 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)]

sys.setrecursionlimit(1000000)
mod = 1000000007


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


def B():
    a,b = LI()
    for i in range(10000):
        if 1+i*a-i >= b:
            print(i)
            return
    return


def C():
    n = I()
    a = LI()
    ans = 0
    r = 1
    for l in range(n):
        if r == l:
            r += 1
        while r < n and a[r-1] >= a[r]:
            r += 1
        ans = max(ans, r-l-1)
    print(ans)
    return


def D():
    n = I()
    print(n*(n-1)>>1)
    return


def E():

    return


def F():

    return


if __name__ == "__main__":
    D()

Solution (Python):
N = input()

print N*(N-1)/2

Solution (Python):











import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,log 
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N = I()
    ans = ((N-1)*N//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())
print((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):
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
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())

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

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

N = int(input())

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

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

print(sum)

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