Task
Problem
Students who attended schools in ancient Rome solved various problems in the classroom. Here is one of the tasks:
101=1
8181515=4
1111112=0
8888888=14
1010101=3
7000007=?
Let the first number be x
and the corresponding n
.
Write a program that, given the number x
, determines n
.
Input
The only non-negative x
number not greater than 101001.
Imprint
Output n
.
Examples