#include<bits/stdc++.h> using namespace std; int l[1000005]; int l2[1000005]; int shu(int x){ int c=0; while(x){ c++; x/=10; } return c-1; } int main(){ int a,b,c=0; cin>>a>>b; for(int i=a;i<=b;i++){ bool d=true; for(int j=shu(i);j>=0;j--){ l[j]=j; } int t=i,t2=0; while(t){ l2[t2]=t%10; t2++; t/=10; } sort(l2,l2+t2); for(int j=0;j<t2;j++){ if(l[j]!=l2[j]){ d=0; } } if(d){ c++; } } cout<<c; return 0; }