g_x, g_y = map(int, input().split()) if (g_x * g_y == 0): if (g_x == 0 and g_y == 0): print(0) else: print(1) else: if (g_x == g_y or g_x == -g_y): print(1) else: print(2)