#B3771. Lucky Numbers Count

    ID: 11430 Type: Default 1000ms 256MiB

Lucky Numbers Count

Lucky Numbers Count

A decimal number is called a lucky number if all of its digits are strictly increasing when read from left to right. For example:

  • $9$, $27$, $1234$ are lucky numbers;
  • $11$, $80$, $243$, $1503$ are not lucky numbers.

Given two integers $a$ and $b$, count the number of lucky numbers in the range $[a, b]$, i.e. among $a, a+1, a+2, \ldots, b$.

The condition for a lucky number can be expressed in LaTeX as:

$$ \text{For a number }N, \text{ if } N = d_1d_2\ldots d_k, \text{ then } d_1 < d_2 < \cdots

inputFormat

The input consists of a single line containing two integers a and b separated by a space, where 1 ≤ a ≤ b.

outputFormat

Output a single integer representing the number of lucky numbers in the range [a, b].

sample

1 10
9