/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
{
Scanner s
=new Scanner
(System.
in); int a[]={-100,-23,-5,0,12,19,27,36,79,100,191};
int low=0,high=a.length-1;
int key=90,ans=-1;
ans=binarySearch(a,low,high,key);
}
public static int binarySearch(int A[],int low,int high,int key){
if(low==high){
if(A[low]==key){
return low;
}
else{
return 0;
}
}
else{
if(low>=high){
return -1;
}
int mid=low+(high-low)/2;
if(A[mid]==key){
return mid;
}
if(key<A[mid]){
return binarySearch(A,low,mid-1,key);
}
else{
return binarySearch(A,mid+1,high,key);
}
}
}
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgovKiBOYW1lIG9mIHRoZSBjbGFzcyBoYXMgdG8gYmUgIk1haW4iIG9ubHkgaWYgdGhlIGNsYXNzIGlzIHB1YmxpYy4gKi8KY2xhc3MgSWRlb25lCnsKCXB1YmxpYyBzdGF0aWMgdm9pZCBtYWluIChTdHJpbmdbXSBhcmdzKSB0aHJvd3MgamF2YS5sYW5nLkV4Y2VwdGlvbgoJewoJCVNjYW5uZXIgcz1uZXcgU2Nhbm5lcihTeXN0ZW0uaW4pOwoJCWludCBhW109ey0xMDAsLTIzLC01LDAsMTIsMTksMjcsMzYsNzksMTAwLDE5MX07CgkJaW50IGxvdz0wLGhpZ2g9YS5sZW5ndGgtMTsKCQlpbnQga2V5PTkwLGFucz0tMTsKCQlhbnM9YmluYXJ5U2VhcmNoKGEsbG93LGhpZ2gsa2V5KTsKCQlTeXN0ZW0ub3V0LnByaW50bG4oYW5zKTsKCQkKCX0KCXB1YmxpYyBzdGF0aWMgaW50IGJpbmFyeVNlYXJjaChpbnQgQVtdLGludCBsb3csaW50IGhpZ2gsaW50IG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