def find_occurrence(l, n):
    i = binary_search_iter(l, n)
    while l[i] == l[i - 1]:
        i -= 1
    count = 1
    while l[i] == l[i + 1]:
        i += 1
        count += 1
    return count
def intersection_two_arrays_bs(seq1, seq2):
    if len(seq1) > len(seq2):
        seq, key = seq1, seq2
    else:
        seq, key = seq2, seq1
    intersec = []
    for item in key:
        if binary_search_iter(seq, item):
            intersec.append(item)
    return intersec
def find_time_occurrence_list(seq, k):
    index_some_k = binary_search_iter(seq, k)
    count = 1
    sizet = len(seq)
    for i in range(index_some_k + 1, sizet):
        if seq[i] == k:
            count += 1
        else:
            break
    for i in range(index_some_k - 1, -1, -1):
        if seq[i] == k:
            count += 1
        else:
            break
    return count