def my_sqrt(x):
    """
    Compute integer part of the square root of given number

    :param x: given integer
    :type x: int
    :return: integer part of the square root
    :rtype: int
    """
    if x < 0:
        return -1
    elif x == 0:
        return 0

    left, right = 1, x
    while left + 1 < right:
        mid = (left + right) // 2
        mid_2 = mid * mid
        if mid_2 == x:
            return mid
        elif mid_2 > x:
            right = mid
        else:
            left = mid
    return left