Stupid Aguin feels confused while reading. The book shows following equations:
$$ 6 = 9 \ , \ 8 = 1010 \ , \ 144 = 75 \ , \ 690 = 801$$
Stupid Aguin doesn't know why and he asks RoyYuan for help. RoyYuan tells Aguin that he only needs to count circles in each number. Notice that 0 , 6 and 9 have one circle, and 8 has two circles. For example, both 690 and 801 have 3 circles, so 690 = 801.
However, Aguin is too stupid to count circles in each number, please help him.
输入格式
The first line contains an integer number T, the number of test cases.
i-th of each next T lines contains an integer number $x$($0 \leq x \leq 10^{9}$).
输出格式
For each test case print a number, the number of circles in $x$.