#include <bits/stdc++.h>          		
using namespace std;              		

int main()                             
{
	int a,t=0;
    cin>>a;
    for(int i=1; i<=a;i++)
    {
        int b=i;
        int g=b%10;
        int s=b/10%10;
        int b1=b/100%10;
        int q=b/1000%10;
        int w=b/10000%10;
        if(g==1)
        {
            t++;
        }
        if(s==1)
        {
            t++;
        }
        if(b1==1)
        {
            t++;
        }
        if(q==1)
        {
            t++;
        }
        if(w==1)
        {
            t++;
        }
    }
    cout<<t;
	return 0;                        	
}

0 comments

No comments so far...