Problem Description
Ali is given an array, which is a permutation of {1, 2, 3 ... , n}. He thinks that only the increasing sequence is harmony, so he wants to change the sequence into a harmony one. But the only operation he can use is: Choosing a contiguous subsequence {A[i], A[i + 1]...A[j]} and do a random shuffling on it. (Random shuffle means that every permutation will appear with equal possibility)
So, what’s the expected number of operations when using the best strategy?
Input
The input consists several testcases.
First line, an integer N (0 < N <= 50) denoting the length of this array.
In the next line there are N integers, representing a permutation.
Output
Print one line with the expectation.
The result should be given with absolute or relative error of at most 10-6.
Sample Input
5
2 1 3 5 4
Sample Output
4.0000000000