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, re, os
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
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7




count = 0
N = INT()

    
    

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

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

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

Solution (Python):

"""
Created on Sat Apr 20 20:47:47 2019

@author: Owner
"""

import numpy as np
import sys
import collections
import scipy.misc
import math
from operator import itemgetter
import itertools
import copy
import bisect
import heapq
from collections import deque


def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(int(i))
    i += 1
  if n > 1:
    table.append(int(n))
  return table   

def digit(i):
    if i > 0:
        return digit(i//10) + [i%10]
    else:
        return []
    
def getNearestValueIndex(list, num):
    """
    概要: リストからある値に最も近い値のインデックスを取得する関数
    @param list: データ配列
    @param num: 対象値
    @return 対象値に最も近い値
    """

    
    idx = np.abs(np.asarray(list) - num).argmin()
    return idx

def find_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default

class UnionFind(object):
    def __init__(self, n=1):
        self.par = [i for i in range(n)]
        self.rank = [0 for _ in range(n)]
        self.size = [1 for _ in range(n)]

    def find(self, x):
        """
        x が属するグループを探索
        """
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def union(self, x, y):
        """
        x と y のグループを結合
        """
        x = self.find(x)
        y = self.find(y)
        if x != y:
            if self.rank[x] < self.rank[y]:
                x, y = y, x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
            self.par[y] = x
            self.size[x] += self.size[y]

    def is_same(self, x, y):
        """
        x と y が同じグループか否か
        """
        return self.find(x) == self.find(y)

    def get_size(self, x):
        """
        x が属するグループの要素数
        """
        x = self.find(x)
        return self.size[x]
    

"""
N, X = map(int, input().split())

x = list(map(int, input().split()))

P = [0]*N
Y = [0]*N
for n in range(N):
    P[n], Y[n] = map(int, input().split())


dp = np.zeros((N+1, 4,4,4))
    
all(nstr.count(c) for c in '753')


ABT = zip(A, B, totAB)
result = 0

sorted(ABT,key=itemgetter(2))
A, B, totAB = zip(*ABT)
A.sort(reverse=True)


(x >> i) & 1


dp = [np.inf]*N
for n in range(N):
    if n == 0:
        dp[n] = 0
    else:
        for k in range(1,K+1):
            if n-k >= 0:
                dp[n] = min(dp[n], dp[n-k] + abs(h[n]-h[n-k]))
            else:
                break

add = 1 
res = 0
sums = [0]*(len(nums)+1)
for i in range(len(nums)):
    sums[i+1] = sums[i] + nums[i]
for i in range(0, len(nums), 2):
    left = i
    right = min(i+add, len(nums))
    tmp = sums[right] - sums[left]
    res = max(tmp, res)


li, ri = bisect.bisect_left(p_ac, l[i]-1), bisect.bisect_right(p_ac, r[i]-1)    


org_list = [3, 1, 4, 5, 2]
new_list = sorted(org_list)
print(org_list)
print(new_list)




    for h in range(0,H):
        for w in range(0,W):
            if h == 0 and w == 0:
                pass
            elif h == 0:
                D[H-h-1][W-w-1]= min(D[H-h-1][W-w-1], D[H-h-1][W-w]+1)
            elif w == 0:   
                D[H-h-1][W-w-1]= min(D[H-h-1][W-w-1], D[H-h][W-w-1]+1)
            else:
                D[H-h-1][W-w-1]= min(D[H-h-1][W-w-1], D[H-h][W-w-1]+1, D[H-h-1][W-w]+1, D[H-h][W-w]+2)
            d_max = max(D[H-h-1][W-w-1], d_max)

"""


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

    
if __name__ == '__main__':
    main()

Solution (Python):


N = int(input())

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

print(ret)

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

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

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

print(res)

Solution (Python):

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

Solution (Python):


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

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

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


if __name__ == "__main__":
    resolve()

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

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

Solution (Python):

N = int(input())

ans = 0

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

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

Solution (Python):
import sys

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

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

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

Solution (Python):





from sys import stdin,setrecursionlimit


setrecursionlimit(10**6)
input=stdin.readline

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

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

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


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

print(modSum)

Solution (Python):


import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N = i2n()
    n = N - 1
    print((n * (1 + n)) >> 1)
    return

main()

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

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

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

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

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

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

Solution (Python):

import sys


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

count = 0




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

print(count)

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

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

m = N-1

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

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

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

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

main()

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

Solution (Python):


n=int(input())

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

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


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


if __name__ == "__main__":
    n = int(input())
    print(main(n))

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

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

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

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

print(result)

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

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

Solution (Python):

mod = 1000000007
ii = lambda :  int(input())
si = lambda :  input()
dgl = lambda : list(map(int, input()))
f = lambda :   map(int, input().split())
il = lambda :  list(map(int, input().split()))
it = lambda :  tuple(map(int, input().split()))
ls = lambda :  list(input())
n=ii()
print(((n)*(n-1))//2)

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

Solution (Python):


import sys

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

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

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

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

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

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

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

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

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

Solution (Python):
def main():
    N = int(input())
    sum_p = sum(range(N))
    print(sum_p)


if __name__ == "__main__":
    main()

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

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

Solution (Python):
import sys
sys.setrecursionlimit(1000000)
from math import factorial, ceil, floor
from bisect import bisect_right as bsr
from operator import itemgetter as ig
from collections import defaultdict as dd
from collections import deque, Counter as cnt


args = None
INF = float("inf")
MOD = int(1e9 + 7)
def input(*ps):
    if type(ps[0]) is list:
        return [input(*ps[0][:-1]) for _ in range(ps[0][-1])]
    elif len(ps) == 1:
        return ps[0](next(args))
    else:
        return [p(next(args)) for p in ps]
def nlist(n, v):
    if not n: return [] if type(v) is list else v
    return [nlist(n[1:], v) for _ in range(n[0])]


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

if __name__ == '__main__':
    args = iter(sys.stdin.read().split())
    main()

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

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

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

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


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

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

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

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

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

Solution (Python):
import itertools

N = int(input())










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

Solution (Python):
import sys


def main():
    n = int(sys.stdin.readline().strip())

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


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

Solution (Python):
import collections as c
ip = lambda : map(int, input().split())

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

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

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

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

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

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

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

print(a)

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

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

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

print(ans)

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

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

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

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

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

Solution (Python):
import sys
import math
from copy import deepcopy
from collections import deque, defaultdict
from operator import mul
from functools import reduce
sys.setrecursionlimit(20000000)




def main():
    n = int(input()) - 1
    ans = 0

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

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

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

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

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

Solution (Python):
import sys
n = int(input())
if n == 1:
    print(0)
    sys.exit()
else:
    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
import math
import collections
import itertools
from inspect import currentframe
INF = 10 ** 10
MOD = 10 ** 9 + 7
def input() : return sys.stdin.readline().strip()
def gcd(x, y) : return y if x % y == 0 else gcd(y, x % y)
def lcm(x, y) : return (x * y) // gcd(x, y)
def I() : return int(input())
def MI() : return map(int, input().split())
def LI() : return [int(x) for x in input().split()]
def RI(N) : return [int(input()) for _ in range(N)]
def LRI(N) : return [[int(x) for x in input().split()] for _ in range(N)]
def chkprint(*args) : names = {id(v):k for k,v in currentframe().f_back.f_locals.items()}; print(', '.join(names.get(id(arg),'???')+' = '+repr(arg) for arg in args))

N = I()

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

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

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

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

if __name__ == '__main__':
    main()

Solution (Python):
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()

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

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

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

print(ans)

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

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

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

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

if __name__ == '__main__':
	main()

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

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

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

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

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

Solution (Python):
from sys import stdin
import math

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

print(ans)

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

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

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):
def solve():
  import sys
  import math

  sys.setrecursionlimit(10**7)

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


if __name__ == '__main__':
  solve()

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

r1 = (n1 * (n1 - 1)) // 2

print(r1)

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





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

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

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

big_prime = 1000000007

"""


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


 =  int(sys.stdin.readline())
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""

N =  int(sys.stdin.readline())

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

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

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

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

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

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

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

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

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

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

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

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

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

print(c)

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())
ans = 0

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

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

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

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

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

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

Solution (Python):
from decimal import *
N = int(input())

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

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

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

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

print(c)

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


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


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

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

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

Solution (Python):
if __name__ == '__main__':
    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-1)*N//2 )

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

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

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

def main():
    input = sys.stdin.readline
    N = int(input())
    ans = (N-1) * N // 2

    return ans


if __name__ == '__main__':
    print(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):
def p_d():
    N = int(input())

    ans = 0
    for i in range(N):
        ans += i

    print(ans)


if __name__ == '__main__':
    p_d()

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

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

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

Solution (Python):
from sys import stdin

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

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

input = lambda: stdin.readline()[:-1]
main()

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

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


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

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

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

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

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

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

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

Solution (Python):
N = int(input())
if (N==1):
    print(0)
else:
    print(sum(range(1, N)))

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

Solution (Python):

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

Solution (Python):
import sys
stdin = sys.stdin
sys.setrecursionlimit(100001)
mod = 10**9 + 7

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
sa = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

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

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

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

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

Solution (Python):
import sys
input = sys.stdin.readline
N = int(input())
m = (1 + (N-1)) * (N-1) // 2
print(m)

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

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

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

import copy
import random
import bisect 
import fractions 
import math
import sys
import bisect


mod = 10**9+7
sys.setrecursionlimit(mod) 

def LI(): return list(map(int, sys.stdin.readline().split()))

N = int(input())

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

print(ans) 


'''
1 0
2 1
3 3
4 6
5 10
6 15
7 21
8 28
9 36
10 45
11 55
12 66
13 78
'''

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):
import math
import collections
import heapq
from collections import defaultdict
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)


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


if __name__ == '__main__':
    main()

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

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

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

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

Solution (Python):

import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline


def read_int():
    return int(input())


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


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap



def slv(N):
    return (N**2 - N)//2


def main():
    N = read_int()
    print(slv(N))


if __name__ == '__main__':
    main()

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

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

from itertools import product

from itertools import permutations

from itertools import combinations

from itertools import accumulate
from bisect import bisect_left, bisect_right
from heapq import heappush, heappop

import re




import sys
sys.setrecursionlimit(10**9)

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


dy = [0, -1, 0, 1]
dx = [1, 0, -1, 0]
 
def i_inpl(): return int(input())
def l_inpl(): return list(map(int, input().split()))
def line_inpl(x): return [i_inpl() for _ in range(x)]

INF = int(1e30)
MOD = int(1e9)+7 


def create_grid(H, W, value = 0):
    return [[ value for _ in range(W)] for _ in range(H)]



def main():
    N = i_inpl()
    if N == 1:
        print(0)
        return
    print(((1+(N-1))*(N-1))//2)
if __name__ == "__main__":
    main()

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

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

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

Solution (Python):
import sys
MAX_INT = int(10e9)
MIN_NUM = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N = I()

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

Solution (Python):

import sys


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

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

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

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

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



resolve()

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

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

Solution (Python):

N = int(input())


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

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

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

print(ans)

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

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

Solution (Python):
import sys, math; from collections import deque; readline=sys.stdin.readline;

N = int(readline())

ans = (N - 1) * N // 2 if N >= 2 else 0
print(ans)

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

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

s=N*(N+1)//2

print(s-N)

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

Solution (Python):

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

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