A famous company is going to select a new Managing Director. All the eligible candidates are waiting in the meeting room. Everyone is seated in a random order linearly. Everyone are cunning and want's to become the Managing Director. If the founder of that company tell's a person name directly definitely that is going to become a serious problem. But the founder already have a person on his mind. But he was thinking for a creative idea to convey the same. Suddenly he notice a pattern follows and he find a way to tell who is the new MD.
He says "the MD of this company is the person who has the age greater than all the other people to his right side."
Write the program to find the new MD of that company where you are provided with the n persons age in order similar to their seating arrangement. In case if the founder couldn't find the next MD print, "The promotion stands cancelled".
Sample Input
7
56 53 52 58 51 56 57
Sample Output
4
int main() {
int n, arr[20],i,j,pos=-1;
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d",&arr[i]);
for(i=0;i<n-1;i++){
for(j=i+1;j<n;j++){
if(arr[i]>arr[j])
continue;
else
break;
}
if(j==n){
pos = i;
break;
}
}
if(pos==-1){
printf("The promotion stands cancelled\n");
}else{
printf("%d",pos+1);
}
return 0;
}