CodeLab Academy 📞 9936 6696
← List Python · Level 10: Algorithms Code · 100 points ← #900 #902 →

#901. Binary search

You get a list sorted in increasing order and x. Use binary search to find the position (from 1) where x appears first. If x is not there, print -1. ### Input The first line has n, the second line has n integers separated by spaces. (sorted) The third line has x. ### Output A number.

Examples

Input
2
13 43
43
Output
2
Input
2
27 49
27
Output
1

💡 You can solve it with Python, JavaScript or blocks. Read the input line by line with input(). Don't print a question (like input("Number: ")). Print exactly what the output asks for, nothing more.

🔒 You can solve the first 3 problems without an account. Sign up for free to solve this one!