#include<bits/stdc++.h>
using namespace::std;
int main(){
int a , b , tmp=0,num=0,ans=0,ret=0;
cin>>a;
for(int i = 1;i <= a;++i){
cin>>b;
for(int i = 1;i <= b;++i){
tmp=i;
while(tmp!=0){
if(ans>1){
break;
}
num=tmp%10;
if(num!=0){
ans++;
}
tmp/=10;
}
if(ans==1){
ret++;
}
ans=0;
}
cout<<ret<<endl;
ret=0;
}
return 0;
}
传送