Blindfold Nim

No attempts yetTime limit2sMemory limit512 MB

Problem

Sprague and Grundy have been playing the game of Nim. They put nn stacks of coins on a table and move alternately. On each turn a player picks one stack and removes any positive number of coins from it. A player who cannot make a valid move loses.

They quickly worked out the optimal strategy, so now they want something more interesting: they decide to play blindfolded. All they know is that the initial number of coins in the ii-th stack is drawn uniformly at random from the integers in [0,ai][0, a_i], every integer in that range being equally likely, and the stacks are drawn independently. A player loses immediately if he tries to take more coins from a stack than it currently holds. In particular, if a player is certain that every stack is empty, he must still move and therefore loses. Sprague moves first. Assuming both players play optimally and can see each other's moves, what is the probability that Sprague wins?

Input

The first line contains an integer nn (1n1061 \le n \le 10^6), the number of stacks. The second line contains nn positive integers a1,a2,,ana_1, a_2, \ldots, a_n. The sum of these integers does not exceed 10610^6.

Output

Print a single real number: the probability that Sprague wins, rounded to exactly 99 digits after the decimal point.