You are given a int[] **permutation** containing a permutation of the first n positive integers (1 through n), and you want to sort them in ascending order. To do this, you will perform a series of swaps. For each swap, you consider all pairs (i, j) such that i < j and **permutation[i]** > **permutation[j]**. Among all those pairs, you choose one randomly and swap **permutation[i]** and **permutation[j]**. Each pair has the same probability of being chosen. Return the expected number of swaps needed to sort **permutation** in ascending order. |