CSES - Inversion Probability
  • Time limit: 1.00 s
  • Memory limit: 512 MB

An array has nn integers x1,x2,,xnx_1,x_2,\dots,x_n, and each of them has been randomly chosen between 11 and rir_i. An inversion is a pair (a,b)(a,b) where a<ba<b and xa>xbx_a>x_b.

What is the expected number of inversions in the array?

Input

The first input line contains an integer nn: the size of the array.

The second line contains nn integers r1,r2,,rnr_1,r_2,\dots,r_n: the range of possible values for each array position.

Output

Print the expected number of inversions rounded to six decimal places (rounding half to even).

Constraints

  • 1n1001 \le n \le 100
  • 1ri1001 \le r_i \le 100

Example

Input:

3
5 2 7

Output:

1.057143