s = int(input()) y = input().split() z = 0
for i in range(s-1): if int(y[i+1]) < int(y[i]): z += 1 if z == 0: print(z) else: print(z-1)