3021: Count Circles

时间限制:1000 ms 内存限制:128 MB
上传者:
提交:7 通过:3

题目描述

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

输入样例 复制

8
6
9
8
1010
144
75
690
801

输出样例 复制

1
1
2
2
0
0
3
3