Time limit
2s
Memory limit
128 MB
Dasom wants to put her room number on the door of her new home using plastic digits.
Plastic digits are sold in sets. Each set contains exactly one digit from 0 through 9. Given the room number N, find the minimum number of digit sets needed to make the number.
The digit 6 can be turned upside down and used as 9, and the digit 9 can be turned upside down and used as 6.
The first line contains the room number N. N is a natural number between 1 and 1,000,000, inclusive.
Print the minimum number of digit sets needed.