#include <bits/stdc++.h> using namespace std; typedef long long LL; LL n,x,t; string b; signed main(){ cin>>n>>x; for (LL i=1;i<n+1;i++){ b = to_string(i); for (LL j=0;j<b.size();j++){ if (b[j]=='1') t+=1; } b=""; } cout<<t; return 0; }