Find Rotation Count

easy
1. Given an ascending sorted rotated array arr of distinct integers of size N. 
2. The array is right rotated K times. 
3. Your task is to find the value of K.

Input Format

Input is managed for you

Output Format

Output is managed for you

Constraints

1 <= N <=10^5
1 <= arr[i] <= 10^7

Notice

Try First, Check Solution later

1. You should first read the question and watch the question video.
2. Think of a solution approach, then try and submit the question on editor tab.
3. We strongly advise you to watch the solution video for prescribed approach.

Example

Input
6
5 6 1 2 3 4
Output
2
Previous
Roof Top
Next
Maximize Sum Of Arr[i]*i Of An Array

Related Questions