a,b=map(int,input().split()) ans=0 for i in range(a,b+1): if (a+b+i)/3 == (a+b+i)//3: ans+=1 print(ans)