A,B = map(int,input().split()) count = 0 for i in range(A,B+1): average = (A + B + i) / 3 if average == int(average): count += 1 print(count)