Back
Close
  • 191

Statement

 Goal

A lucky number is a 10-based number, which has at least a "6" or an "8" in its digits. However, if it has "6" and "8" at the same time, then the number is NOT lucky. For example, "16", "38", "666" are lucky numbers, while "234" , "687" are not.

Now we want to know how many lucky numbers (without leading zeroes) are there between L and R, inclusive?
Input
Line 1: Two integers, L and R.
Output
Line 1: An integer, indicating the amount of lucky numbers between [ L , R ].
Constraints
1≤LR≤10^18
Example
Input
1 10
Output
2

A higher resolution is required to access the IDE