a,b = map(int,input().split()) c = 1 if (2*a+b) % 3 > 0 and (2*b+a) % 3 > 0 : c = 0 print((b-a) // 3 + c )