print((function (a, b) local t,r=(a+b)%3~=0 and 3-(a+b)%3 or 0,0 for i=a,b do if i%3==t then r=r+1 end end return r end)(io.stdin:read("*n"), io.stdin:read("*n")))