#Lean Mean Bean Machine, 38 32 bytes
-5 bytes thanks to Roman Gräf
-1 byte from changing LMBM's division peg from £
to ,
O O
i 2
o
)/
,
/
/
*
u
##Explanation
Each O
spawns a marble at program start. The first marble reads input and has it's value set to it, the 2nd has it's value set to 1, and the 3rd has it's value set to 2.
The n-marble is then duplicated, one copy falls all the way to a multiplication operator, where it will be held for a 2nd marble, the other falls into a subtraction operator, which the 1-marble then falls into after it.
This new n-1-marble then falls into a division operator (,
), and the 2-marble falls in right after it.
This (n-1)/2-marble then falls into the multiplication operator, and the final n*(n-1)/2
marble falls into a u
peg, where its value is printed, and the marble is destroyed.