Hide

Problem H
Double Palindromes

Languages en is

You are given a positive integer $n$ and should print the number of positive integers $< n$ which are a palindromes both in base $10$ and base $2$.

Input

The first and only line of input contains a positive integer $n \leq 10^{12}$.

Output

Print the number of positive integers $< n$ which are a palindromes both in base $10$ and base $2$.

Sample Input 1 Sample Output 1
1000000
20

Please log in to submit a solution to this problem

Log in