Canadian Computing Competition: 2000 Stage 1, Junior #2
The digits , , and look much the same if rotated degrees on the page (turned upside down). Also, the digit looks much like a , and vice versa, when rotated degrees on the page. A multi-digit number may also look like itself when rotated on the page; for example and do, but and do not.
You are to write a program to count how many numbers from a given interval look like themselves when rotated degrees on the page. For example, in the interval there are six: , , , , , and .
Your program should take as input two integers, and , which define the interval to be checked, . The output from your program is the number of rotatable numbers in the interval.
You may assume that all input is valid.
Sample Input
1
100
Sample Output
6
Comments
easy