import numpy as np
N = int(input())
hi = np.array(list(map(int,input().split())))
hi_0 = hi[(hi -hi[0])>=0]-hi[0]
result = sum([-1 for i in range(1,len(hi_0)) if hi_0[i]-hi_0[i-1]<0])+len(hi_0)
print(result)