#include<bits/stdc++.h> using namespace std; const int Max=7; bool b[Max]; bool check(int n) { int s=0; int x=1; while(n>=x) { x=x*10; s++; } memset(b,false,sizeof(b)); while(n!=0) { if(n%10>s-1) { return false; } b[n%10]=true; n=n/10; } for(int i=0;i<=s-1;i++) { if(b[i]==false) { return false; } } return true; } int main() { int a,b; cin>>a>>b; int s=0; for(int i=a;i<=b;i++) { if(check(i)) { s++; } } cout<<s; return 0; }