def binary_search(A, x):
    low = 0
    high = (len(A) - 1)
    mid = 0
    while (low <= high):
        mid = ((high + low) // 2)
        if (A[mid] < x):
            low = (mid + 1)
        elif (A[mid] > x):
            high = (mid - 1)
        else:
            return True
    return False
def binary_search(A, x):
    low = 0
    high = (len(A) - 1)
    mid = 0
    while (low <= high):
        mid = ((high + low) // 2)
        if (A[mid] < x):
            low = (mid + 1)
        elif (A[mid] > x):
            high = (mid - 1)
        else:
            return True
    return False