#t88. 好事成双

好事成双

A Pair of Good Things

Problem Description

Dazhi's father has finished his engineering project smoothly, and his mother has been promoted to manager — truly a pair of good things. To celebrate, Dazhi's father wants to set Dazhi a problem (poor Dazhi). We now define a "good-thing pair": for two numbers a,ba, b, if a=2ba=2b or b=2ab=2a holds, then aa and bb are said to be a "good-thing pair". Given an array, count how many good-thing pairs it contains.

Input Format

A sequence of positive integers, each not exceeding 9999 and all distinct, ending with the number 00 to mark the end of input.

Output Format

Output one integer as the answer.

Sample Input

1 4 3 2 9 7 18 22 0

Sample Output

3

Hint

1 4 3 2 9 7 18 22 0

There are 33 pairs in total: 22 and 11, 44 and 22, 1818 and 99.