n= int(input()) i=10**9+1 cnt=0 while i<=n: istr=str(i) if istr==istr[::-1]: cnt+=1 i+=(10**9+1) print(cnt)