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

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

Solution (Python):



N = int(input())

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

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

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

if __name__ == "__main__":
    main()

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

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

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

print(ans)

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

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

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

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

print(ans)

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

print(ans)

Solution (Python):


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



N = int(input())


n = N-2
count = (n*(4+(n-1)))//2




count += 1

print(count)

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

cnt = 0

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

print(cnt)

Solution (Python):

n = int(input())

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

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

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

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

N = int(input())

n = N - 1
if bool(n%2):
    ans = (n//2) * (n) + n
else:
    ans = (n//2) * (n+1)

print(ans)

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

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

print(ans)

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

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

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

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

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

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

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

print(ans)

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

Solution (Python):
def main(n):
    print(n * (n - 1) // 2)

if __name__ == '__main__':
    n = int(input())
    main(n)

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

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

if __name__ == "__main__":
    main()

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

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

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

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

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

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

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

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

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

Solution (Python):
def func():
    N = int(input())
    sum = 0
    for i in range(1, N + 1):
        sum += i

    print(sum-N)


if __name__ == '__main__':
    func()

Solution (Python):
R = [0, 0, 1]
while True:
    try:
        N = int(input())
        
        if N <= 2:
            print(R[N])
        else:
            print((N-1)*(N-2)//2 + N - 1)
    except:
        break

Solution (Python):
from decimal import Decimal

n = Decimal(input())

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

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

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

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

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

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

Solution (Python):

import math
N = int(input())-1
M = 0
x = int(math.ceil((N)/2))
if N%2 == 0:
    M = x*(N+1)
else:
    M = (x-1)*(N+1)+x
print(M)

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

def add(n):
    if n%2 == 0:
        return sum(range(1,n))
    else:
        p = (n // 2 ) + 1
        return (n % p) + sum(range(1,n)) - (p-1)

print(add(n))

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

Solution (Python):
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
N=int(input())

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

Solution (Python):

N=int(input())

n=N-1

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

print(s)

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

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

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

target = N
out = 0
while target > 2:
    if target % 2 == 0:
        mueikyo_start = 1
        mueikyo_end = target-1
        out += ( (mueikyo_start + mueikyo_end) * (mueikyo_end - mueikyo_start+1) // 2 )
        break
    else:
        mueikyo_start = (target // 2) + 1
        mueikyo_end = target - 1
        out += ( (mueikyo_start + mueikyo_end) * (mueikyo_end - mueikyo_start+1) // 2 )
        out += ( target % mueikyo_start)
        target = target // 2
        

if target == 2:
    out += (1+0)
elif target == 1:
    out += 0

print(out)

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

Solution (Python):


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

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

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

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

print(ans)

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

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

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

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

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

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


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

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

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

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

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

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

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

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


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

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

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

Solution (Python):


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

if __name__ == '__main__':
    main()

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

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

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

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

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

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

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

Solution (Python):



n=int(input())

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



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

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

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

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

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

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

print(ans)

Solution (Python):
import sys
import math

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    [N] = string_to_int(inputs[0])
    num = N - 1
    if num == 0:
        return 0
    if num == 1:
        return 1
    if num % 2 == 0:
        
        
        half = num // 2
        append = num // 2
    else:
        half = (num + 1) // 2
        append = 0
        
    return half * num + append


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    ret = solve(inputs(1))
    print(ret)

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

N = int(inputs[0])

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

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

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

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

Solution (Python):
import sys

input = sys.stdin.readline


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


if __name__ == "__main__":
    main()

Solution (Python):
N = int(input()) - 1
sum = 0

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

print(int(sum))

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

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

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

Solution (Python):
def main():

    n = int(input())
    sum = 0

    for i in range(n-1):
        sum += i+1
    
    print(sum)



if __name__ == '__main__':
    main()

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

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

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

if n == 1:
    print(0)
else:
    print(sum(range(n)))

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

n = N - 1
result = 0

if n != 0:
    result = n * (n+1) // 2

print(result)

Solution (Python):

import sys







"""Template"""


class IP:
    """
    入力を取得するクラス
    """

    def __init__(self):
        self.input = sys.stdin.readline

    def I(self):
        """
        1文字の取得に使います
        :return: int
        """
        return int(self.input())

    def S(self):
        """
        1文字の取得(str
        :return: str
        """
        return self.input()

    def IL(self):
        """
        1行を空白で区切りリストにします(int
        :return: リスト
        """
        return list(map(int, self.input().split()))

    def SL(self):
        """
        1行の文字列を空白区切りでリストにします
        :return: リスト
        """
        return list(map(str, self.input().split()))

    def ILS(self, n):
        """
        1列丸々取得します(int
        :param n: 行数
        :return: リスト
        """
        return [int(self.input()) for _ in range(n)]

    def SLS(self, n):
        """
        1列丸々取得します（str
        :param n: 行数
        :return: リスト
        """
        return [self.input() for _ in range(n)]

    def SILS(self, n):
        """
        Some Int LineS
        横に複数、縦にも複数
        :param n: 行数
        :return: list
        """
        return [self.IL() for _ in range(n)]

    def SSLS(self, n):
        """
        Some String LineS
        :param n: 行数
        :return: list
        """
        return [self.SL() for _ in range(n)]


class Idea:
    def __init__(self):
        pass

    def S(self, s, r=0, m=-1):
        """
        ソート関係行います。色々な設定あります。
        :param s: 元となるリスト
        :param r: reversするかどうか 0=False 1=True
        :param m: （2次元配列）何番目のインデックスのソートなのか
        :return: None
        """
        r = bool(r)
        if m == -1:
            s.sort(reverse=r)
        else:
            s.sort(reverse=r, key=lambda x: x[m])

    def ceil(self, x, y):
        """
        Round up
        小数点切り上げ割り算
        :param x: int
        :param y: int
        :return: int
        """
        return -(-x // y)

    def ave(self, a):
        """
        平均を求めます
        :param a: list
        :return: int
        """
        return sum(a) / len(a)

    def gcd(self, x, y):
        if y == 0:
            return x
        else:
            return self.gcd(y, x % y)

    def lcm(self, x, y):
        return (x * y) // self.gcd(x, y)


"""ここからメインコード"""


def make_divisors(n):
    
    for i in range(2, int(n ** 0.5) + 1):
        if n % i == 0:
            
            return i
            
            


def n_to_10(X, n):
    if int(X / n):
        return n_to_10(int(X / n), n) + str(X % n)
    return str(X % n)


def main():
    ip = IP()
    id = Idea()
    """この下から書いてね"""
    n = int(input())
    memo = (n*n-n)//2
    print(memo)


main()

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

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

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

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

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

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

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

Solution (Python):
import sys
 
N = int(input())
 
if N==1:
  print(0)
  sys.exit()

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

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

Solution (Python):


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


if __name__ == "__main__":
    main()

Solution (Python):
N = int(input())
if N == 1:
  print("0")
else:
  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(sum(range(1,N)))

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

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

Solution (Python):
from decimal import *

N = Decimal(input())

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

print(Decimal(record))

Solution (Python):
def solve(n):
    res = (n - 1) * n // 2
    return res


def main():
    n = int(input())
    res = solve(n)
    print(res)


if __name__ == "__main__":
    main()

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

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

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

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

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

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

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

res=sum(range(0, n))
print(res)

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

Solution (Python):

I0 = lambda :map(int,input().split())
I1 = lambda :int(input())
I2 = lambda :list(map(int,input().split()))

n = I1()
res = 0
n-=1
print(n*(n+1)//2)
'''
for i in range(1,n+1):
    Mi = i % pi
    res+=Mi
'''

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

if (N-1) % 2 == 0:
    intSum = N*count
else:
    intSum = N*count + count + 1

print(intSum)

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

Solution (Python):


''' 
------------------------
author : iiou16
------------------------
'''


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

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

if __name__ == '__main__':
    main()

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

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

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

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

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

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


print(sumNum)

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

a = list(range(1, N+1))

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

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

Solution (Python):
import sys

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

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

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

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

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

a0 = 1
l = n - 1
r = (a0 + l) * (n - 1) // 2
print(r)

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

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

Solution (Python):
from sys import stdin


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

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


if __name__ == "__main__":
    main()

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

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

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

if __name__ == "__main__":
    f_d()

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

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

Solution (Python):
from decimal import Decimal 

N = int(input())

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

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

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

Solution (Python):

import sys

import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

readl= lambda: list(map(int, sys.stdin.readline().split()))
readt= lambda: tuple(map(int, sys.stdin.readline().split()))
read = lambda: sys.stdin.readline().rstrip()
readi = lambda: int(read())
readmi = lambda: map(int, sys.stdin.readline().split())
readms = lambda: map(str, sys.stdin.readline().split())

n = readi()

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

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

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

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

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



if __name__ == "__main__":
    main()

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

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

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

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

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

Solution (Python):
import numpy as np
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 = 0
if N%2 == 0:
    ans = N//2 * (N-1)
else:
    ans = (N-1)//2 * N
print(ans)

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

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

n-=1

ret = int(n*(n+1)//2)


print(ret)

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

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

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

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

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

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

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

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

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

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

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

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

Solution (Python):
def s(n):
  return N * (N + 1) // 2
N = int(input())

result = s(N-1) - N

print(result)

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 sys


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


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


if __name__ == "__main__":
    main()

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

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

ans = 0

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

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

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

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

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

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

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

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

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

Solution (Python):
def calc(N):
    return (N - 1) * N // 2


N = int(input())
print(calc(N))

Solution (Python):
import sys


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


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

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


if __name__ == '__main__':
    main()

Solution (Python):

import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
from collections import defaultdict
from heapq import heappop, heappush
import itertools
input = sys.stdin.readline






















def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))

def main():
	N = inputInt()

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

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

print(ans)

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

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

Solution (Python):

import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
from collections import defaultdict
from heapq import heappop, heappush
import itertools
input = sys.stdin.readline






















def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))

def main():
	N = inputInt()

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

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

	print(ans)

if __name__ == "__main__":
	main()

Solution (Python):
def stair_sum(x):
    return (x * (x+1)) // 2


target = int(input())

print(stair_sum(target-1))

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

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

s = 1
e = n-1

if s == e:
  print(1)
  exit()

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

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

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

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

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

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

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

print(int(res))

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

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

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

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

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

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

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

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

p = []

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

Solution (Python):
import sys

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

n = ni()

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

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

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

print(ans)

Solution (Python):











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

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

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

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

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

print(ans)

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

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

max_value = n - 1

ret = max_value * (max_value + 1) // 2

print(ret)

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

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

Solution (Python):
import itertools
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:
    ans = 0
else:
    ans = N * (N + 1) // 2 - N

print(ans)

Solution (Python):


n = int(input())
s = n - 1

print(s*(s+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())

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

print(m)

Solution (Python):









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

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

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

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

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

Solution (Python):
import sys

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


if __name__ == "__main__":
    resolve()

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

Solution (Python):


N = int(input())

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

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

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

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

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

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

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

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

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

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

print(ans)

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

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

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

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

A = N-1

answer = A * N//2
print(answer)

Solution (Python):


n = int(input())

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

print(a)

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

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

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

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

Solution (Python):
from sys import stdin

if __name__ == '__main__':
    N = int(stdin.readline().rstrip())
    print( ((N-1) * N) // 2)