A, B = map(int, input().split()) ans = 0 for i in range(A, B + 1): v = A + B + i if v % 3 == 0: ans += 1 print(ans)