import bisect
x = [1, 1, 2, 3, 5, 5, 8, 13]
i = bisect.bisect_left(x, 5)
print('i = {}'.format(i))
j = bisect.bisect(x, 5)
print('j = {}'.format(j))
