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