#abc114c. [abc114_c]755
[abc114_c]755
Problem Statement
You are given an integer . Among the integers between and (inclusive), how many Shichi-Go-San numbers (literally "Seven-Five-Three numbers") are there?
Here, a Shichi-Go-San number is a positive integer that satisfies the following condition:
- When the number is written in base ten, each of the digits
7
,5
and3
appears at least once, and the other digits never appear.
Constraints
- is an integer.
Input
Input is given from Standard Input in the following format:
Output
Print the number of the Shichi-Go-San numbers between and (inclusive).
Sample Input 1
575
Sample Output 1
4
There are four Shichi-Go-San numbers not greater than : and .
Sample Input 2
3600
Sample Output 2
13
There are Shichi-Go-San numbers not greater than : the above four numbers, and .
Sample Input 3
999999999
Sample Output 3
26484