def p_d():

    N = int(eval(input()))



    ans = 0

    for i in range(N):

        ans += i



    print(ans)





if __name__ == '__main__':

    p_d()

def p_d():

    N = int(eval(input()))



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

    

if __name__ == '__main__':

    p_d()

def p_d():
    N = int(eval(input()))
    ans = 0
    for i in range(N):
        ans += i
    print(ans)


if __name__ == "__main__":
    p_d()

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


if __name__ == "__main__":
    p_d()

-    ans = 0 -    for i in range(N): -        ans += i -    print(ans) +    print((N * (N - 1) // 2))