# Function to find the occurrence of the given target
# using binary search
def countFreq(arr, target):
l = bisect_left(arr, target)
r = bisect_right(arr, target)
# Return the difference between upper bound and
# lower bound of the target
return r - l
if **name** == "**main**":
arr = [1, 2, 2, 2, 2, 3, 4, 7, 8, 8]
target = 2
print(countFreq(arr, target))