#include<bits/stdc++.h> using namespace std; int f(int x){ int v,l,k=0,d=0,s=0; v=x; l=x; while(v){ k++; v/=10; } for(int j=1;j<k;j++){ d+=j; } while(l){ if(l%10>=k){ return 0; }else s+=l%10; l/=10; } if(s==d){ return 1; }else return 0; } int main(){ int n,m,h=0; cin>>n>>m; for(int i=n;i<=m;i++) { if(f(i)==1){ h++; } } cout<<h-1; return 0; }