1488. Double

Recently, Jvruo became obsessed with a fighting game. In this game, nn characters stand on an arena from left to right, and the combat power of the ithi_{th} character is aia_i. For each operation, Jvruo will choose two adjacent characters xx and yy on the arena for a duel. If ax>aya_x> a_y, then xx wins, if ax<aya_x < a_y, then yy wins. If ax=aya_x = a_y, then both xx and yy have a probability of 50%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 n1n−1 operations, after n1n−1 operations, there will only be one character left in the ring. Obviously, Jvruo has (n1)!(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.

输入

The first line contains a positive integer n(1n5105)n(1 \le n \le 5 * 10^5), which represents the number of the characters.

The second line contains nn integers separated by spaces ai(1ai109)a_i(1 \le a_i \le 10^9), which represents the the combat power of the ithi_{th} character.

输出

The first line contains a positive integer mm, 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 mm integers in ascending order separated by spaces bi(b1<b2<<bm)b_i(b_1 < b_2 < …… < b_m), which represents the the index of the characters who have the probability to stay till the end and become the final winner.

样例

标准输入 复制文本
3
1 2 3
标准输出 复制文本
2
2 3
标准输入 复制文本
3
2 2 4
标准输出 复制文本
3
1 2 3
标准输入 复制文本
5
1 2 30 16 1
标准输出 复制文本
2
3 4

来源

2021 GDCPC 广东省大学生程序设计竞赛

登录以提交代码。
单点时限 1 秒
内存限制 512 MB
提交 5
通过 5