def solution(n: int=1000000) -> int:
    result = 0
    maxLength = 0
    for i in range(n):
        counter = sequenceLength(i)
        if (counter > maxLength):
            result = i
            maxLength = counter
    return result
def solution(n: int=1000000) -> int:
    result = 0
    maxLength = 0
    for i in range(n):
        counter = sequenceLength(i)
        if (counter > maxLength):
            result = i
            maxLength = counter
    return result