# -*- coding: utf-8 -*-
"""
Created on Wed Jan  9 21:15:17 2019

@author: Faradars-pc2
"""

def binary_search(ozv, majmooe):
    imin, imax = 0, len(majmooe)
    while True:
        if imin >= imax:
            return -1
        midpoint = (imin + imax) // 2
        if majmooe[midpoint] > ozv:
            imax = midpoint
        elif majmooe[midpoint] < ozv:
            imin = midpoint + 1
        else :
            return midpoint