program two; var st:string; l,r,i,n,s:longint; begin s := 0; read (l,r); for n := l to r do begin str(n,st); for i := 1 to length(st) do if st[i]='2' then inc(s); end; writeln (s); end.