#include <bits/stdc++.h> using namespace std; long int n,m,ans=0; struct node { int gs; int a[10]; bool jg; }; node temp; int f(int t) { temp.a[0]=0; temp.a[1]=0; temp.a[2]=0; temp.a[3]=0; temp.a[4]=0; temp.a[5]=0; temp.a[6]=0; temp.a[7]=0; temp.a[8]=0; temp.a[9]=0; int x,sum=0; while(t!=0) { x=t%10; sum++; temp.a[x]++; t/=10; } temp.gs=sum; temp.jg=true; return 0; } int sl(int t) { int sum=0; while(t!=0) { t/=10; sum++; } return sum; } int main() { cin>>n>>m; int d; for(int i=1;i<=m;++i) { d=i; f(d); for(int j=0;j<sl(d);j++) { if(temp.a[j]!=1) { temp.jg=false; } } if(temp.jg==true) { ans++; } } cout<<ans; return 0; }