#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
#define f(i,a,b) for(int i=a;i<b;i++)
#define f2(i,a,b) for(int i=a;i<=b;i++)
int a,b;
int ans=0;
bool LuckyNum(int x){
	ll cnt=0;
	int d=0;
	while(x>0){
		int t=x%10;
		cnt+=(1<<t);
		x/=10;
		d++;
	}
	ll c=1;
	while(d--) c*=2;
	if(--c==cnt) return true;
	else return false;
}
int main(){
	cin>>a>>b;
	f2(i,a,b) if(LuckyNum(i)) ans++;
	cout<<ans;
	return 0;
}