a, b = map(int, input().split()) x = (-a - b) % 3 print((b - x) // 3 - (a - x - 1) // 3)