import sys import math sys.setrecursionlimit(10 ** 7) def input() : return sys.stdin.readline().strip() def INT() : return int(input()) def MAP() : return map(int,input().split()) def LIST() : return list(MAP()) def NIJIGEN(H): return [list(input()) for i in range(H)] N=int(input()) L=list(map(int,input().split())) if N==1 or N==2: print(0) exit() a=L[0] p=-1 ans=list() for i in range(1,N): if p==-1: if L[i]>a: p=1 count=2 elif L[i]a and p==1: count+=1 elif L[i]>a and p==0: ans.append(count) count=2 p=1 elif L[i]