2023, the Year of the Black Rabbit
InterviewTime limit2sMemory limit512 MB
Count how many serial numbers from 1 to N have 2023 as a subsequence of their digits.
Problem
2023 is known as the year of the black rabbit. Star wants to make a black cat lottery to celebrate the year of the black rabbit.
A black cat lottery has tickets in total. Each ticket has a serial number that is an integer from to , and no two tickets share the same serial number.
A ticket wins if its serial number has at least four digits and you can pick four digits at different positions, erase all the other digits, and get 2023. For example, 2023 wins, 1280423 wins, and 2200233 wins, while 3480, 572, and 2032 lose.
Input
The number of tickets in the black cat lottery is given. ()
Output
Print the number of winning tickets.