9C.md (1052B)
1 Source: https://codeforces.com/problemset/problem/9/C 2 3 C. Hexadecimal's Numbers 4 5 time limit per test 6 7 1 second 8 9 memory limit per test 10 11 64 megabytes 12 13 input 14 15 stdin 16 17 output 18 19 stdout 20 21 One beautiful July morning a terrible thing happened in Mainframe: a mean virus Megabyte somehow got access to the memory of his not less mean sister Hexadecimal. He loaded there a huge amount of *n* different natural numbers from 1 to *n* to obtain total control over her energy. 22 23 But his plan failed. The reason for this was very simple: Hexadecimal didn't perceive any information, apart from numbers written in binary format. This means that if a number in a decimal representation contained characters apart from 0 and 1, it was not stored in the memory. Now Megabyte wants to know, how many numbers were loaded successfully. 24 25 Input 26 27 Input data contains the only number *n* (1 ≤ *n* ≤ 109). 28 29 Output 30 31 Output the only number — answer to the problem. 32 33 Examples 34 35 Input 36 37 ``` 38 10 39 ``` 40 41 Output 42 43 ``` 44 2 45 ``` 46 47 Note 48 49 For *n* = 10 the answer includes numbers 1 and 10.