n=int(input()) a=list(map(int,input().split())) s=[] for i in range(n-1): s+=["<" if a[i]"] b=0 c=0 for i in range(len(s)): if s[i]==">": b+=i-c c+=1 print(b)