IntermediateRating 1450
How Many 1s?
Count how many times the digit 1 appears when you write all numbers from 1 to n.
Input
One integer n (0 ≤ n ≤ 10¹⁵).
Output
One integer.
Sample 1
Input
13
Output
6
Sample 2
Input
0
Output
0
Output appears hereOne integer n (0 ≤ n ≤ 10¹⁵).
One integer.
13
6
0
0
Output appears here