A,B=map(int,input().split()) x = (3 - (((A%3) + (B%3))%3))%3 a = (A-x)//3 b = (B-x)//3 print(b-a+1) if a < b else print(b)