Module Module1

    Sub Main()

        Dim N As Long = Console.ReadLine()
        Dim i As Long
        Dim modsum As Long

        modsum = 0
        For i = 2 To N
            modsum += i - 1
        Next

        Console.WriteLine(modsum)

        'Console.ReadLine()

    End Sub

End Module
