a, b = list(map(int, input().split(' '))) n = 0 int_num = [i for i in range(b)] for i in range(a, b+1): if (a+i+b)/3 in int_num: n+=1 print(n)