Олимпиадный тренинг

Задача 39624. To the ternary number system


Given a natural number N not greater than 108 . It is required to determine how many even digits are included in its entry in the ternary number system.
Input
number N written in decimal notation.
Imprint
the number of even digits included in the record of the number N in the ternary number system.
Examples
# Input Output Explanation
1 4 0 410=113
2 15 2 1510=1203