Time limit
1s
Memory limit
64 MB
Digits on a digital display are shown by turning strokes on and off, like the numbers on an elevator display.
A number is called a mirror number if, when reflected in a mirror, it still reads as the original number. Under reflection, 0, 1, and 8 remain themselves, while 2 and 5 turn into each other. All other digits do not appear as valid digits. Therefore a mirror number can use only 0, 1, 2, 5, and 8, and the digits must match from both ends under this reflection rule.
For instance, 0, 101, and 1521 are mirror numbers, while 1221 and 1010 are not.




Given two integers A and B, write a program that prints how many mirror numbers are between A and B, inclusive.
The first line contains two integers A and B separated by a space.
Print the number of mirror numbers between A and B, inclusive.