#include<bits/stdc++.h> using namespace std; int wei(int n) { int cnt = 0; while(n) { cnt++; n /= 10; } return cnt; } int main() { int a, b, cnt = 0; cin >> a >> b; for(int i = a; i <= b; i++) { int l = wei(i), t = i; string s, s1; for(int j = 0; j < l; j++) s += '0' + j; while(t) { s1 += '0' + t % 10; t /= 10; } sort(s1.begin(), s1.end()); if(s == s1) cnt++; } cout << cnt; return 0; }