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