632. Partition Array

0

Medium

Alice and Bob wants to divide the array in two subarrays. But they need your help to solve the problem.
You are given an integer array nums, partition it into two (contiguous) subarrays left and right so that:
* Every element in left is less than or equal to every element in right.
* left and right are non-empty.
* left has the smallest possible size.
Print the length of left after such a partitioning.
**Note : Test cases are generated such that partitioning exists.**

Input Format

First Line contains a single Integer **N** (Size of array)

Second Line consisting of Array.

Second Line consisting of Array.

Output Format

Print the length of the left subarray

Example

Input

5
5 0 3 8 6

Output

3

Constraints

2 <= N <= 10

0 <= Arr[i] <= 10

^{5}0 <= Arr[i] <= 10

^{5}Loading...

View Submissions

Console