Pivot of sorted and rotated array

code-https://ide.codingblocks.com/s/28758
daught - output is 2 but given output is 1 why please solve this

ques-PIVOT OF SORTED AND ROTATED ARRAY
You are given a sorted but rotated array. You need to fine the index of the pivot element of the array where pivot is that element in the array which is greater than its next element and divides the array into two monotonically increasing halves.

Input Format:
The first line denotes N - the size of the array. The following N lines each denote the numbers in the array.

Constraints:
Output Format
Output the index of the pivot of the array.

Sample Input
5
4
5
1
2
3
Sample Output
1

@S18LPC-OL0078 for the better explanation go through this video in which bhaiya explain about this problem link.