n=int(input()) a=[int(input())for _ in range(n)] ans=0 for i in range(n-1): if a[i]>=a[i+1]:ans+=1 print(ans)