cswork / OAOpen practice workspace

MetaOA #10

Three-Digit Numbers With All Distinct Digits

Estimated EasyJudge-ready

Topics (AI-labelled)Bits & Math

Given a closed range [left,right], count the three-digit integers in it whose hundreds, tens, and ones digits are pairwise different. The original site's answer of 5 for 476..979 is wrong, so this site uses an example recomputed from the definition.

Input

One line with left right (100≤left≤right≤999).

Output

Output the answer as described; separate multiple results with spaces in order, and output an empty line for an empty array.

Example 1

Input:

476 979

Output:

371

Example 2

Input:

100 100

Output:

0

Example 3

Input:

102 102

Output:

1

Example notes

Example 1: checking each three-digit number from 476 to 979, there are 371 integers whose digits are pairwise different; for example, 476 is valid and 477 is not.

Editorial

Loading solution…