a = int(input()) b = int(input()) cnt = 0 for i in range(a,b+1): c = (a + b + i)%3 if c == 0: cnt = cnt + 1 print(cnt)