#include <bits/stdc++.h> using namespace std; int a,b,s; bool u[15]; bool work(int n) { memset(u,0,sizeof(u)); int t=n; int wei=0,ma=-1; while(n!=0) { int g=n%10; n/=10; if(g==0&&n==t) { return 0; } if(u[g]==1) return 0; u[g]=1; wei++; ma=max(ma,g); } if(ma>wei) return 0; else { for(int i=0; i<9; i++) { if(u[i]==0&&i<wei) return 0; if(u[i]==1&&i>=wei) return 0; } return 1; } } int main() { ios::sync_with_stdio(0); cin.tie(0);cout.tie(0); cin>>a>>b; for(int i=a; i<=b; i++) { if(work(i)) s++; } cout<<s; return 0; }