# -*- coding: utf-8 -*- def inpl(): return map(int, input().split()) A, B = inpl() ans = 0 for i in range(A, B+1): ans += (A+B+i)%3==0 print(ans)