#Lutece0796. DAGE(Big Brother)
DAGE(Big Brother)
Migrated from Lutece 796 DAGE(Big Brother)
All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.
Description
Our famous “DAGE”, God Kufeng, likes killing monsters. However, killing monsters is a tiring job, and might do harm to DAGE’s health.
Now there are n monsters, each monster has a strength value. Let’s say, before killing a monster with strength , DAGE has a health point(HP) as , then after killing, DAGE’s HP will become
Here &
means bitwise AND. For example, , .
At first, the health point(HP) of DAGE will be .
DAGE has a simple strategy, each time he just randomly choose a monster to kill, and kill that monster.
When DAGE’s HP becomes , DAGE will feel tired and go home to sleep.
What is the expected number of monsters DAGE has killed when DAGE goes to bed? It is guaranteed that DAGE will go to bed at some moment.
Input
The first line contains a single number , the number of the monsters. ()
The the second line comes with numbers , those are the strenght value of each monster. .
Output
Output a single number in a line, the expected number of monsters DAGE has killed when he goes to bed, rounded to 3 digits after decimal point.
Samples
Resources
the 12th UESTC Programming Contest Preliminary