401366: GYM100418 F Sexless marriage agency

Memory Limit:64 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

F. Sexless marriage agencytime limit per test2 secondsmemory limit per test64 megabytesinputstandard inputoutputstandard output

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.

Input

The 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.

Output

At 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.

ExamplesInput
6
2 2 6 14 1 30
Output
2
2 6
1 4

加入题单

算法标签: