spoj#LUDIC2. Ludic Numbers (hard)
Ludic Numbers (hard)
Find the number of Ludic numbers less than or equal to $N$.
Input
The first line contains an integer $N$ ($1 \le N \le 10^{11}$).
Output
Output the number of Ludic numbers less than or equal to $N$.
Example
Input
100000000000
Output
3603128157
Note
- See LUDIC1 for an easier version.
- Other references for the Ludic numbers: Ludic numbers or A003309.