a,b = map(int,input().split()) c = 0 for i in range(b-a+1): d = a+i if d%3 == 0: c += 1 elif str(d) in 3: c += 1 print(c)