def hansu(num): count=0 a=[] for i in range(1,num+1): a=list(map(int,str(i))) if i<100: count+=1 elif a[0]-a[1]==a[1]-a[2]: count+=1 return count n=int(input()) print(hansu(n))