A sorted set of $n$ integers (duplicates allowed) is given, then a value $k$. Print the 1-based position of the first element that is $\ge k$. If every element is less than $k$, print $n + 1$.
Input
Line 1: $n$. Line 2: $n$ sorted integers. Line 3: $k$.
Output
Print the 1-based lower-bound position.
Example 1
Input
5 1 3 5 7 7 7
Output
4
Example 2
Input
8 1 2 3 5 7 9 11 15 6
Output
5
Example 3
Input
5 1 2 3 4 5 7
Output
6
Example 4
Input
5 2 2 2 2 2 1
Output
1
Discussion
Threads about this problem. Spoilers are collapsed; wrap hints in
||double bars||.No discussion yet. Start a thread if something here needs explaining.