initial = input().split() A = int(initial[0]) B = int(initial[1]) count = 0 for i in range(A, B + 1, 1): if (A + B + int(i)) % 3 == 0: count += 1 print(count)