We’re preparing your current view and syncing the latest data.
Given a list of integers, find the largest subset such that the bitwise OR of all numbers in this subset is a power of two (also known as a round number). A round number is a positive integer with exactly one set bit in its binary representation, e.g., 1, 2, 4, 8, 16, ... Output the size of the largest such subset and the indices of the elements in that subset.
The first line contains a single integer n (1 ≤ n ≤ 2·10^5) — the number of elements. The second line contains n integers a_1, a_2, ..., a_n (1 ≤ a_i ≤ 10^9) — the elements of the array.
First, output a single integer k — the size of the largest subset whose bitwise OR is a power of two. On the next line, output k distinct integers — the indices (1-based) of the elements from the subset in any order.
1 ≤ n ≤ 2·10^5; 1 ≤ a_i ≤ 10^9
Example 1
Input
5 3 6 8 2 4
Output
3 2 4 5
Explanation
The subset consisting of elements at indices 2 (6), 4 (2), and 5 (4) has a bitwise OR of 6 | 2 | 4 = 6, which is 110 in binary and not a power of two. A better subset would be elements at indices 3 and 4 (8 and 2). The OR is 10 in binary which is 8 or 2? 8 is 1000, 2 is 10, OR is 1010 (10), so no. The best is subset with elements at indices 4 and 2 or just 4 (2). For this input, the largest subset with OR power of two is size 3: elements at indices 2 (6), 5 (4), and 4 (2) have OR 6|4|2 = 6+4+2 is not a power of two. Actually the best subset is just {3} with element 8 since 8 is a power of two. So output is 1 and 3.