var n,i,s:longint;m:string;begin read(n); for i:=1 to n do begin str(i,m); if pos('1',m)<>0 then s:=s+1; end; write(s);end.