import math


def isqrt(x):
    """Return the integer square root of the nonnegative integer x"""
    if not isinstance(x, int):
        raise ValueError(f"Expected integer. Received [{type(x)}] {x}.")
    if x < 0:
        raise ValueError(f"Expected non-negative integer. Received {x}.")
    return math.isqrt(x)