uva11332測資B

Input:
8
13
183
4477
98765
999999
8000008
60000000
980760540
1999999998
0
Output:
8
4
3
4
8
9
7
6
3
9