def solve_chess_puzzle(gx: int, gy: int) -> int: # For rook (Luke): We need to move horizontally and vertically # Minimum moves for rook is 1 if on same row/column, otherwise 2 rook_moves = 1 if gx == 0 or gy == 0 else 2 # For bishop: We can move diagonally # If target is on diagonal (|x| = |y|), we need 1 move # Otherwise, we need 2 moves to reach any point bishop_moves = 1 if abs(gx) == abs(gy) else 2 # Return the minimum of both possibilities return min(rook_moves, bishop_moves) def main(): # Read input gx, gy = map(int, input().split()) # Print result print(solve_chess_puzzle(gx, gy)) if __name__ == "__main__": main()