#include<bits/stdc++.h> using namespace std; int a,b,vis[1000005],sum,l=1,k=1,w1,w2,cnt; bool check(int x,int w){ memset(vis,0,sizeof(vis)); while(x){ if(x%10>=w)return 0; if(vis[x%10])return 0; vis[x%10]=1; x/=10; } return 1; } int main(){ scanf("%d %d",&a,&b); int z=a; while(z){ w1++; l*=10; z/=10; } l/=10; int y=b; while(y){ k*=10; w2++; y/=10; } k/=10; for(int i=a;i<l;i++){ if(check(i,w1))sum++; } for(int i=k;i<=b;i++){ if(check(i,w2))sum++; } for(int i=w1+1;i<w2;i++){ cnt=1; for(int j=i-1;j>=1;j--)cnt*=j; cnt*=i-1; sum+=cnt; } printf("%d",sum); return 0; }