Random shuffle#1584

Random shuffle

2 seconds
128 megabytes
Easy

You are given a permutation of length .

Consider the following random shuffling procedure applied to the initial array \{1, 2, \ldots, n\}.

For i = 1, 2, \ldots, n, the following operation is performed in order:

All choices of are independent. Therefore, there are exactly n^n equally likely sequences of random choices.

Determine the probability that after performing all operations, the resulting array is .

Input

Each line represents a separate test. It contains an integer n~(1 \le n \le 10), followed by the elements of array — a permutation of numbers from to .

Output

For each test, print the required probability in a separate line. The answer must contain at least digits after the decimal point.

Examples

Example 1

Loading
Loading