def xyz(a,n,L,h):
while L<=h:
mid=L+(h-L)//2
if a[mid]==n:
return mid
elif a[mid]<n:
L=mid+1
else:
h=mid-1
return -1
a=[1,2,3,4,5,6,7,8,9]
n=int(input("Enter the number to search"))
r=xyz(a,n,0,len(a)-1)
if r!= -1:
print("Element found at index:"+str(r))
else:
print("Element not found ")
ZGVmIHh5eihhLG4sTCxoKToKICAgIHdoaWxlIEw8PWg6CiAgICAgICAgbWlkPUwrKGgtTCkvLzIKICAgICAgICBpZiBhW21pZF09PW46CiAgICAgICAgICAgcmV0dXJuIG1pZAogICAgICAgIGVsaWYgYVttaWRdPG46CiAgICAgICAgICAgTD1taWQrMQogICAgICAgIGVsc2U6CiAgICAgICAgICAgaD1taWQtMQogICAgcmV0dXJuIC0xCmE9WzEsMiwzLDQsNSw2LDcsOCw5XQpuPWludChpbnB1dCgiRW50ZXIgdGhlIG51bWJlciB0byBzZWFyY2giKSkKcj14eXooYSxuLDAsbGVuKGEpLTEpCmlmIHIhPSAtMToKICAgcHJpbnQoIkVsZW1lbnQgZm91bmQgYXQgaW5kZXg6IitzdHIocikpCmVsc2U6CiAgIHByaW50KCJFbGVtZW50IG5vdCBmb3VuZCAiKQogICA=