|The problem statement contains superscripts and subscripts that can be seen in the applet.|
Given a randomly generated sequence, it can be useful to know how unsorted it is. The sequence
a1, a2, a3, a4, ... , angets 1 'unsortedness point' for every distinct pair (i,j) where i < j but ai > aj. The terms in the sequence are defined by the following formula:
a1 = 1 and ak = (m * ak-1 + c) % (231 - 1)Here % denotes the modulus or remainder operator. Return the number of unsortedness points scored by this n-element sequence.
|-||Make sure to use 64-bit types when generating the random values.|
|-||m will be between 1 and 2000000000 inclusive.|
|-||c will be between 0 and 2^31-2 inclusive.|
|-||n will be between 3 and 100000 inclusive.|