- Time limit: 1.00 s
- Memory limit: 512 MB
An array has integers , and each of them has been randomly chosen between and . An inversion is a pair where and .
What is the expected number of inversions in the array?
Input
The first input line contains an integer : the size of the array.
The second line contains integers : 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
Example
Input:
3 5 2 7
Output:
1.057143