Puzzle
题号:NC200598
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

Hery is going to junior high school, and he meets a problem during his entrance examination: We define
f(x) as the sum of the number of cycles for each digit of x. More specifically, 1, 2, 3, 5, 7 have 0 cycle, 0,4, 6, 9 have 1 cycle and 8 has 2 cycles. For example:

f(81) = 2, f(88) = 4, f(0) = 1, f(1000) = 3

Please help hery calculate f(x).

输入描述:

The first line of input contains an integer  - the numbers of test cases in the input.For the next T lines ,each line contains a number .

输出描述:

For each x,output the value of f(x).
示例1

输入

复制
6
1
10
3
9
1000
68

输出

复制
0
1
0
1
3
3