Page not loading? Try clicking here.
Placeholder

#2408

page 1s - MB

Problems

Given a book with pages 1 through N, write a program that determines the total number of times a page number appears. The numbers are written in decimal, and any leading 0 is considered nonexistent.

For example, a 19-page book would have page numbers 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19. Here, 0 is page 1, 1 is page 12, 2 is page 2, 3 is page 3, ... 9 is page 2.


Input

The input is an integer N greater than or equal to 1 and less than or equal to 1,000,000,000.


Output

The output is the number of times 0, 1, 2, 3, ..., 9 from the left. There must be a space between the numbers.


Example #1

7
0 1 1 1 1 1 1 1 0 0

Example #2

11
1 4 1 1 1 1 1 1 1 1

Example #3

19
1 12 2 2 2 2 2 2 2 2

Example #4

999
189 300 300 300 300 300 300 300 300 300
You must sign in to write code.