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

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

    return 0

if __name__ == "__main__":
    solve()

Solution (Python):



N = int(input())


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


print(ans)

Solution (Python):

n = int(input())

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

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

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

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

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

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

Solution (Python):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin
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 STR(): return input()
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 = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]

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

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

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

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

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

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

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

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

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

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(input())

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

Solution (Python):


import sys
input = sys.stdin.readline
n = int(input()) 






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

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

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

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

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

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

Solution (Python):


def submit():
    n = int(input())
    s = n * (n + 1) // 2
    print(s - n)


if __name__ == "__main__":
    submit()

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

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

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

Solution (Python):
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

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

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

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

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

Solution (Python):

from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

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


if __name__ == "__main__":
    solve()

Solution (Python):

n = int(input())

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

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

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

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

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

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

Solution (Python):
from decimal import Decimal

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

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

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

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

print(int((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)
  exit(0)


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

Solution (Python):

"""
D - ModSum
https://atcoder.jp/contests/abc139/tasks/abc139_d

"""
import sys


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


def main(args):
    N = int(input())
    ans = solve(N)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

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

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

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

Solution (Python):



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

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

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

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


if __name__ == '__main__':
    main()

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

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

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

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

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

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

Solution (Python):

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

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

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

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

print(ans)

Solution (Python):
import sys


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

if __name__ == '__main__':
    main()

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

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

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

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

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

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

Solution (Python):
import sys
from bisect import *
from heapq import *
from collections import *
from itertools import *
from functools import *

sys.setrecursionlimit(100000000)
input = lambda: sys.stdin.readline().rstrip()

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

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

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

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

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

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

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

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

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

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

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

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

print(ans)

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

Solution (Python):
import math 
import bisect
import heapq
from collections import deque

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

Solution (Python):

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


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

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

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

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

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

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

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

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

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

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

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

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

Solution (Python):
from sys import stdin

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

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

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

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

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

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

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

Solution (Python):





import collections
import sys

ipti = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)

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

if __name__ == '__main__':
    main()

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

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

Solution (Python):
n = int(input())
d,m = divmod(n,2)
if m != 0:
    print(n*d)

else:
    print(n*(d - 1) + d)

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

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

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

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

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

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

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

Solution (Python):



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

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

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

answer=0

answer+=(N**2-N)//2

print(answer)

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

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

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

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

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

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

Solution (Python):
import sys
import numpy as np

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
printV = lambda x: print(*x, sep="\n")
printH = lambda x: print(" ".join(map(str,x)))
def IS(): return sys.stdin.readline()[:-1]
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LII(rows_number): return [II() for _ in range(rows_number)]
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]

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


if __name__ == '__main__':
	main()

Solution (Python):
import sys
import numpy as np

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
printV = lambda x: print(*x, sep="\n")
printH = lambda x: print(" ".join(map(str,x)))
def IS(): return sys.stdin.readline()[:-1]
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LII(rows_number): return [II() for _ in range(rows_number)]
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]

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


if __name__ == '__main__':
	main()

Solution (Python):



from math import floor

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

if __name__=='__main__':
  main()

Solution (Python):

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

Solution (Python):
import sys

n = int(sys.stdin.readline().rstrip())

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

if __name__ == '__main__':
    ans = main()
    print(ans)

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

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

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

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

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

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

Solution (Python):


a = input()

b = int(a)

ans = 0

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

print(ans)

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

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

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

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

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

Solution (Python):

import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [input() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [int(input()) for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def roundUp(a, b):
        return -(-a // b)

    @staticmethod
    def toUpperMultiple(a, x):
        return Math.roundUp(a, x) * x

    @staticmethod
    def toLowerMultiple(a, x):
        return (a // x) * x

    @staticmethod
    def nearPow2(n):
        if n <= 0:
            return 0
        if n & (n - 1) == 0:
            return n
        ret = 1
        while(n > 0):
            ret <<= 1
            n >>= 1
        return ret

    @staticmethod
    def sign(n):
        if n == 0:
            return 0
        if n < 0:
            return -1
        return 1

    @staticmethod
    def isPrime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True

    @staticmethod
    def divisor(n):
        i = 1
        table = []
        while i * i <= n:
            if n % i == 0:
                table.append(i)
                table.append(n // i)
            i += 1
        table = list(set(table))
        return table


class PriorityQueue:
    def __init__(self, l=[]):
        self.__q = l
        heapq.heapify(self.__q)
        return

    def push(self, n):
        heapq.heappush(self.__q, n)
        return

    def pop(self):
        return heapq.heappop(self.__q)

    def list(self):
        return self.__q


sys.setrecursionlimit(1000000)
MOD = int(1e09) + 7
INF = int(1e30)


def main():
    
    N = Scanner.int()
    print(N * (N - 1) // 2)
    return


if __name__ == "__main__":
    main()

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

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

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

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

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

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

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

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

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

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

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

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()

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

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()


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

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 6)


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


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

if __name__ == "__main__":
    main()

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

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

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

Solution (Python):


N = int(input())

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

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

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

_n = int(input())
print(solve(_n))

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

_n = int(input())
print(solve(_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-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 main():
    N=int(input())

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

if __name__=='__main__':
    main()

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

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

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

mod = 1000000007
inf = 1 << 60
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()
nas = lambda: stdin.readline().split()

n = ni()

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

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

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

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

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

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

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

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

Solution (Python):




def solve(inp):
    N = int(inp.readline().strip())

    r = (N * (N - 1)) // 2
    return int(r)


def main():
    import sys
    result = solve(sys.stdin)
    if result is not None and result != '':
        print(result)


if __name__ == '__main__':
    main()

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

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

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

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

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

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

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

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

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

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

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

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

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


main()

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

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

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

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

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

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

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

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

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

    print(ans)

    return 0
if __name__ == '__main__':
    main()

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

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

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

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

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

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

Solution (Python):
import math, string, itertools, fractions, heapq, collections, re, array, bisect, copy, functools, random
import sys
from collections import deque, defaultdict, Counter; from heapq import heappush, heappop
from itertools import permutations, combinations, product, accumulate, groupby
from bisect import bisect_left, bisect_right, insort_left, insort_right
from operator import itemgetter as ig
def main():
    sys.setrecursionlimit(10 ** 7)
    """inf = 10 ** 20; INF = float("INF"); ans = 0; tmp = 0; cnt = 0; ansli = []; tmpli = []; candili = []; stillset = set()
    eps = 1.0 / 10 ** 10; mod = 10 ** 9 + 7
    dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]; ddn = dd + [(-1, 1), (1, 1), (1, -1), (-1, -1)]; ddn9 = ddn + [(0, 0)]"""
    """for dx, dy in dd:
            nx = j + dx; ny = i + dy
                if 0 <= nx < w and 0 <= ny < h:"""
    def wi(): return list(map(int, sys.stdin.readline().split()))
    def wip(): return [int(x) - 1 for x in sys.stdin.readline().split()]
    def ws(): return sys.stdin.readline().split()
    def i(): return int(sys.stdin.readline())
    def s(): return input()
    def s_list(): return list(input())
    def hi(n): return [i() for _ in range(n)]
    def hs(n): return [s() for _ in range(n)]
    def mi(n): return [wi() for _ in range(n)]
    def num_grid(n): return [[int(i) for i in sys.stdin.readline().split()[0]] for _ in range(n)]
    def mip(n): return [wip() for _ in range(n)]
    def ms(n): return [ws() for _ in range(n)]
    def grid(n): return [s_list() for _ in range(n)]

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


if __name__ == '__main__':
    main()

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

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

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


N = int(input())

print(solve(N))

Solution (Python):
import sys
import math
import heapq
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, m=DVSR): return pow(x, m - 2, m)
def DIV(x, y, m=DVSR): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def II(): return int(input())
def FLIST(n):
    res = [1]
    for i in range(1, n+1): res.append(res[i-1]*i%DVSR)
    return res
def gcd(x, y):
    if x < y: x, y = y, x
    div = x % y
    while div != 0:
        x, y = y, div
        div = x % y
    return y

N=II()

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

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

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

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

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

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

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

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

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

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

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

Solution (Python):

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

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

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

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

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

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

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

Solution (Python):
def main():
    '''
    N = aq + r (0 <= r <= a-1)よりΣrを最大にするのはr = a-1のとき
    '''
    N = int(input())
    print(N * (N - 1) // 2)


if __name__ == '__main__':
    main()

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

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

Solution (Python):

N = int(input())






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

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

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

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    N = I()
    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):
def t(N):
    return N*(N-1)//2
N=int(input())
print(t(N))

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

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

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

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

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



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

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

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

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

Solution (Python):


import math
import sys
import fractions
N = int(input())
print(N*(N-1)//2)

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

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

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

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

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

Solution (Python):
def sum(n):
    return ((n + 1) * n) // 2


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

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

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

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