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

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

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

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

n = N - 1

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

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

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

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

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):
import sys
sys.setrecursionlimit(int(1e6))

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

print(ans)

Solution (Python):
import sys
sys.setrecursionlimit(int(1e6))

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

print(ans)

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

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

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

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

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

num = 0

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

print(num)

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

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

print(output)

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

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

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

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

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

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

Solution (Python):

N = int(input())

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

Solution (Python):

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

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

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())
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 numpy as np

n=int(input())
print(int((n-1)*n//2))
"""
if n==1:
    print(0)
else:
    plist=list(range(1,n+1))
    qlist=list(range(2,n+1))
    qlist.append(1)
    parray=np.array(plist)
    qarray=np.array(qlist)
    rarray=parray%qarray
    sm=rarray.sum()
    print(sm)
"""

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

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

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('{}'.format(int((N * (N - 1)) // 2 )))

Solution (Python):


import sys

debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    n = int(lines[0])

    return (n,)


def solve(n):

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

    return result


def main():
    
    result = solve(*parse_input())
    if isinstance(result, list):
        for r in result:
            print("%s" % r)
    else:
        print("%s" % result)


if __name__ == '__main__':

    main()

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

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

n = int(input())
print(sum(range(1,n)))

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

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

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

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

Solution (Python):

import sys
 

def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def ISI(): return map(int, sys.stdin.readline().rstrip().split())
def II(): return int(sys.stdin.readline().rstrip())
def ISS(): return sys.stdin.readline().rstrip().split()
def IS(): return sys.stdin.readline().rstrip()
 
N = II()
sum = N*(1+N)//2
print(sum-N)

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

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

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

a = N/2
b = int(N/2)
if not(N%2 == 0):
    Mmax = N*b
elif N%2 == 0:
    Mmax = N*(b-1) + b



print(Mmax)

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

Solution (Python):
import sys
import numpy as np
def main():
    input = sys.stdin.readline
    N = np.int64(input())
    
    
    ans = (1 + (N - 1)) * (N - 1) // 2
    print(int(ans))
if __name__ == '__main__':
    main()

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

if __name__ == '__main__':
    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())

N = N -1

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

print(mysum)

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

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

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

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

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

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

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

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

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













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


print(sum)

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

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

Solution (Python):
N=int(input())
print('{}'.format((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-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())
n = N -1
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):
import sys
n = int(sys.stdin.readline())
print(n*(n-1)//2)

Solution (Python):
import math

N = int(input().split()[0])








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

print(ans)

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

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

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

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

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

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

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

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

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

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

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

Solution (Python):
import copy

def j(n):
    if n:print("yes")
    else:print("no")
    exit(0)
rem = 10 ** 9 + 7

"""
def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")
"""

def ip():
    return int(input())
def iprow():
    return [int(i) for i in input().split()]
def ips():
    return (int(i) for i in input().split())
def ipmultiplerow(n):
    a = []
    for i in range(n):
        a.append(ip())
    return a
def printrow(a):
    for i in a:
        print(i)
n = ip()
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

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

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

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

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

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

Solution (Python):

"""
AtCoder A
"""

import sys, math, random
import numpy as np








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 list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
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 S(): return input()


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

if __name__ == "__main__":
    main()

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

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

Solution (Python):


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

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

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

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

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

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

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

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

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

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

print(int(MM))

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

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

Solution (Python):
N=int(input())
print('{}'.format(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())
ans = N*(N-1)//2
print(ans)

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

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

a = x*n
print(a//2)

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

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

print(int(ans))

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

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

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


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

if N == 1:
    sum = 0
elif N ==2:
    sum = 1

print(int(sum))

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Solution (Python):
import numpy as np

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

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

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

print(x)

Solution (Python):
import sys

sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return list(map(int, sys.stdin.readline().split()))
def II(): return int(sys.stdin.readline())
def LS(): return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]

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

if __name__ == '__main__':
    main()

Solution (Python):
import math
import queue

mod = 1e9+7

def swap(a,b):
    return (b,a)

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

def divisors(a):
    divisors = []
    for i in range(1,int(a**0.5)+1):
        if a%i==0:
            divisors.append(i)
            if i!=a//i:
                divisors.append(a//i)
    return divisors

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

if __name__ == '__main__':
    main()

Solution (Python):

def sol(n):
    if n <= 0: return 0
    if n == 1:
        return 0
    if n == 2:
        return 1
    x = n - 1
    if x % 2 == 0: 
        return ((x + 1) * int(x/2))
    else: 
        return ((x + 1) * int(x/2)) + int((x+1)/2)



n = int(input().strip())
print (sol(n))

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

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

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

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

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

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

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

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

print(ans)

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

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

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

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

print(sum)

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

Solution (Python):
n = int(input())
a, b = divmod((n - 1) * n, 2)
print(a)

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

Solution (Python):


N = int(input())



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

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

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

a = x*n
print(int(a//2))

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

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

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

print(ans)

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


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

print(sum)

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

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):
from sys import stdin

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

Solution (Python):
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
n = int(input())

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

print(ans)

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

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

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

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

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

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

n= N-1

sum = (n*N)//2

print(sum)

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

Solution (Python):

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

Solution (Python):
S = int(input())
total=10*6
if(S%2==1):
    total=S*((S-1)//2)
else:
    total=(S-1)*((S-2)//2)+(S-1)

print(total)

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

    print(N * (N - 1)//2)
    
if __name__ == '__main__':
    p_d()

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

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

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

print(sum)

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

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

Solution (Python):
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
n = int(input())

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

print(ans)

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

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

Solution (Python):
import sys
from pprint import pprint

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

if __name__ == '__main__':
    n = int(sys.stdin.readline().strip())
    solve(n)

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



N -= 1

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

print(calc)

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

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

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

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

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

print(ans)

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

Solution (Python):
import sys


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


def main():
    N = int(input())
    ret = 0
    for i in range(1, N):
        ret += i
    print(ret)


if __name__ == '__main__':
    main()

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

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

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

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

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

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

print(int(ans))

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

Solution (Python):
import sys


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


def main():
    N = int(input())
    ret = 0
    for i in range(1, N):
        ret += i
    print(ret)


if __name__ == '__main__':
    main()

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

Solution (Python):
from decimal import *

N = int(input())



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

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

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

Solution (Python):

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

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

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

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

def summation(num):
    factor = divmod(num, 2)
    return (int(num / 2) * (1 + num)) + (factor[0] + 1) * factor[1]

tmp = int(summation(N))
print(tmp - N)

Solution (Python):
import numpy as np
N=int(input())
count=N*(N-1)//2
print(count)

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

Solution (Python):

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

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

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

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

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

print(ans)

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

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 = input()
N = int(N)
if not(1 <= N and N <= 10**9):
    exit()
ans = 0

if N % 2 == 0:
    i = int(N/2)
    ans = (N+1) * i
    ans -= N
else:
    i = int(N/2)
    ans = N * i

    
print(ans)

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

Solution (Python):



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


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

    ans = solve(N)

    print(ans)

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

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

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

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

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

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

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

Solution (Python):


from decimal import Decimal


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

    if n == 1:
        print(0)
        return

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


if __name__ == "__main__":
    main()

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

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

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

print(int(ans))

Solution (Python):
import numpy as np
N = int(input())
one_of_N = 0
other_N = 0

if N % 2 == 0:
  one_of_N = int(N / 2)
  other_N = N - 1
else:
  one_of_N = int((N - 1) / 2)
  other_N = N
  
result = (one_of_N * other_N)
print('{}'.format(result))

Solution (Python):
n = int(input())
if n == 1:
    print(0)
else:
    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)

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

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

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

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 math
from decimal import *
N=int(input())
getcontext().prec = 15000
ans=(Decimal(N)*Decimal(N-1))/2
print((Decimal(ans)))

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

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

print(int(sum(range(n+1))-n))

Solution (Python):
import math
import copy
import sys
import fractions
import numpy as np
from functools import reduce



def getInputInt():
    inputNum = int(input())
    return inputNum

def getInputListInt():
    outputoData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData

def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList

def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList



n, = map(int, input().split())


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

print(ans)

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

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

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

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

Solution (Python):
import sys

n = int(input())

if n == 2:
    print(1)
    sys.exit()




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



print(int(ans))

Solution (Python):
import sys
sys.setrecursionlimit(1000000) 

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

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

print(ans)

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

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

Solution (Python):
import math
import queue

mod = 1e9+7

def swap(a,b):
    return (b,a)

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

def divisors(a):
    divisors = []
    for i in range(1,int(a**0.5)+1):
        if a%i==0:
            divisors.append(i)
            if i!=a//i:
                divisors.append(a//i)
    return divisors

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

if __name__ == '__main__':
    main()

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

Solution (Python):
import decimal

N = decimal.Decimal(input())
print(N * (N - 1) / 2)

Solution (Python):
import sys

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

Solution (Python):
import sys
INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
sys.setrecursionlimit(10 ** 9)


def main():
    N = INT()

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

    print(ans)


if __name__ == '__main__':
    main()

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

Solution (Python):


N = int(input())

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

print(ans)

Solution (Python):


N = int(input())

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

Solution (Python):

from decimal import Decimal
n = int(input())
n = n-1
answer = 0

if n % 2 == 0:
	answer = (Decimal(n)+Decimal(1))*(Decimal(n)/2)
else:
	answer = Decimal(n)*((Decimal(n)-Decimal(1))/2) + Decimal(n)

print(int(round(answer,0)))

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




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

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

N = int(input())
total = sum(range(1, N))
  
print(total)

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

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

Solution (Python):
n = int(input())
if n%2==0:
  even = n
  odd = n-1
else:
  even = n-1
  odd = n
even_2 = int(even/2)

print(even_2*odd)

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