#include<bits/stdc++.h>
using namespace std;
int h[7];
int main()
{
	int a,b,ws,tf=1,ans=0;
	cin>>a>>b;
	for(int i=a;i<=b;i++)
	{
		h[0]=0;
		h[1]=0;
		h[2]=0;
		h[3]=0;
		h[4]=0;
		h[5]=0;
		h[6]=0;
		h[7]=0;
		tf=1;
		int ti=i; 
		while(ti>1)
		{
			if(ti%10==0) h[0]++;
			if(ti%10==1) h[1]++;
			if(ti%10==2) h[2]++;
			if(ti%10==3) h[3]++;
			if(ti%10==4) h[4]++;
			if(ti%10==5) h[5]++;
			if(ti%10==6) h[6]++;
			if(ti%10==7) h[7]++;
			ti/=10;
			ws++;
			for(int j=1;j<=6;j++)
			{
				cout<<h[j]<<" ";
			}
			cout<<endl;
		}
		for(int j=1;j<=ws;j++)
		{
			if(h[j]!=1)
			{
				tf=-1;
			}
		}
		if(tf==1) 
		{
			ans++;
			cout<<i<<endl;
		}
	}
	cout<<ans<<endl;
	return 0;
}