401366: GYM100418 F Sexless marriage agency
Description
There are N individuals numbered from 1 to N in the database of clients of Martial sexless marriage agency. The founder of the agency is a programmer whose hobby is extrasensory perception, so to determine whether two individuals are happily married or not the agency counts the total number of hairs on their bodies. If the total amount of hairs is a power of two, the couple will live happily, otherwise the agency does not give any guarantees. The agency gave you the database of clients and asked for your help. Determine the maximum number of possible successful marriages given the fact that martians are monogamous and marry once in their lives.
InputThe first line contains the number N (1 ≤ N ≤ 105). The second line contains N integer numbers Ai (0 ≤ Ai < 1018), denoting the quantity of hairs on the martian with number i.
OutputAt the first line output the number M, denoting the maximum number of possible successful marriages. At the next M lines output pairs Fi and Si separated by a single space — indexes of married martians.
ExamplesInput6Output
2 2 6 14 1 30
2
2 6
1 4