#include<bits/stdc++.h>
using namespace std;
int c[10000]={0},a,b,n,s=0,x,s1=1,j;
bool d=true;
int main()
{
	cin>>a>>b>>x;
	for(int i=n;i<=j;i++)
	{
		int j=i;
		d=true;
		while(j!=0)
		{
			a[x]=j%10;
			j/=10;
			x+=1;
			s1+1=;
		}
		int x1=1;
		x=s-1;
		sort(a+1,a+x+1);
		while(x>=0&&x1<s1)
		{
			if(a[x]!=x1)
			d=false;
			break;
		}
		s++;																																																																																																																																			}																																																																																																																																							
	}
	cout<<s<<" ";
	return 0;
}