4303: 幸运数字

Memory Limit:128 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:28 Solved:17

Description

如果⼀个正整数 n 在五进制、七进制、九进制的表⽰下都没有数字 “0”,我们就称 n 是幸运数字。

例如:十进制的数字987转换为五进制,七进制,九进制 分别是 12422,2610,1316,因此 987 不是幸运数字。

十进制的数字988转换为五进制,七进制,九进制分别是12423,2611,1317,因此 988 是幸运数字。 

写程序求出a,a+1,a+2......b 之间⼀共有多少个幸运数字。

Input

100 1000

Output

203

Sample Input Copy

900 4096

Sample Output Copy

389