#P1171. Double

    ID: 172 远端评测题 1000ms 256MiB 尝试: 0 已通过: 0 难度: (无) 上传者: 标签>广东省第十八届大学生程序设计竞赛(GDCPC2021)

Double

Description

Recently, Jvruo became obsessed with a fighting game. In this game, n characters stand on an arena from left to right, and the combat power of the ith character is ai . For each operation, Jvruo will choose two adjacent characters x and y on the arena for a duel. If ax > ay, then x wins, if ax < ay, then y wins. If ax = ay, then both x and y have a probability of 50% to win. The victorious character will stay in the arena and double the combat power; the losing character will leave the arena.

Now Jvruo will perform n − 1 operations, after n − 1 operations, there will only be one character left in the ring. Obviously, Jvruo has (n − 1)! operation modes. In all these modes of operation, which characters have the probability to stay till the end and become the final winner.

Input

The first line contains a positive integer n(1 ≤ n ≤ 5∗10e5), which represents the number of the characters.

The second line contains n integers separated by spaces ai(1 ≤ ai ≤ 10e9), which represents the the combat power of the ith character.

Output

The first line contains a positive integer m, which represents the number of the characters who have the probability to stay till the end and become the final winner.

The second line contains m integers in ascending order separated by spaces bi(b1 < b2 < …… < bm), which represents the the index of the characters who have the probability to stay till the end and become the final winner

5
1 2 30 16 1
2
3 4