def find_upper_bound(x):
    """
    find_upper_bound returns an integer n with n >= len(x), without using the
    len() function. The complexity is O(log(len(x)).
    """
    n = 1
    while True:
        try:
            v = x[n]
        except IndexError:
            return n
        n *= 2