A,B = map(int, input().split())

cnt = 0

for i in range(A,B+1):
    cnt += (A+B+i)%3 < 1

print(cnt)