#include<bits/stdc++.h>
using namespace std;
int main(){
	long long x,y,z=0,l=0,t;
	cin>>x>>y;
	for(int i=x;i<=y;i++){
		int m=0;
		t=i;
		while(t){
			t=t/10;
			z++;
		}
		int n=i;
		if(z==2&&n==10){
			l=l+1;
		}
		if(z==3&&(n==120||n==210||n==201||n==102)){
			l=l+1;
		}
		if(z==4){
			for(int a=1;a<=3;a++){
				for(int b=0;b<=3;b++){
					for(int c=0;c<=3;c++){
						for(int d=0;d<=3;d++){
							if(a!=b&&b!=c&&c!=d&&a!=d&&b!=d&&c!=d){
								if(n=a*1000+b*100+c*10+d){
									l=l+1;
								}
							}
						}
					}
				}
			}
		}
		if(z==5){
			for(int a=1;a<=4;a++){
				for(int b=0;b<=4;b++){
					for(int c=0;c<=4;c++){
						for(int d=0;d<=4;d++){
							for(int e=0;e<=4;e++){
								if(a!=b&&a!=c&&a!=d&&a!=e&&b!=c&&b!=d&&b!=e&&c!=d&&c!=e&&d!=e){
									if(n=a*10000+b*1000+c*100+d*10+e){
										l=l+1;
									}
								}
							}
						}
					}
				}
			}
		}
		if(z==6){
			for(int a=1;a<=6;a++){
				for(int b=0;b<=6;b++){
					for(int c=0;c<=6;c++){
						for(int d=0;d<=6;d++){
							for(int e=0;e<=6;e++){
								for(int f=0;f<=6;f++){
									if(a!=b&&a!=c&&a!=d&&a!=e&&a!=f&&b!=c&&b!=d&&b!=e&&b!=f&&c!=d&&c!=e&&c!=f&&d!=e&&d!=f&&e!=f){
										if(n=a*100000+b*10000+c*1000+d*100+e*10+f){
											l=l+1;
										}
									}
								}
							}
						}
					}
				}
			}
		}
		if(z==7){
			for(int a=1;a<=7;a++){
				for(int b=0;b<=7;b++){
					for(int c=0;c<=7;c++){
						for(int d=0;d<=7;d++){
							for(int e=0;e<=7;e++){
								for(int f=0;f<=7;f++){
									for(int g=0;g<=7;g++){
										if(a!=b&&a!=c&&a!=d&&a!=e&&a!=f&&a!=g&&b!=c&&b!=d&&b!=e&&b!=f&&b!=g&&c!=d&&c!=e&&c!=f&&c!=g&&d!=e&&d!=f&&d!=g&&e!=f&&e!=g&&f!=g){
											if(n=a*1000000+b*100000+c*10000+d*1000+e*100+f*10+g){
												l=l+1;
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
	}
	cout<<l;
	return 0;
}