Processing math: 100%
Unlucky number - MarisaOJ: Marisa Online Judge

Unlucky number

Time limit: 1000 ms
Memory limit: 256 MB
As we know, the number 13 is considered an unlucky number. In East Asian culture, specifically in China and Japan, the number 4 is also considered unlucky due to its pronunciation similarity to the word "death." A number is considered unlucky if its decimal representation contains the digit 4 or 13. For example, 132 is unlucky, 40 is unlucky, while 193 is not. Count the number of positive integers that are unlucky and do not exceed n. ### Input - A single line containing an integer n. ### Output - Print the count of unlucky integers that satisfy the condition. ### Constraints - 1≤n≤1018. ### Example Input: 1234 Output: 343