program Main integer(8) N read *, N print *, N*(N-1)/2 end program Main