#include<bits/stdc++.h>
using namespace std;
int n,x,ans;
stack<int> s;
int main(){
scanf("%d",&n);
for(int i=1;i<=n;i++){
scanf("%d",&x);
if(i!=1&&s.top()>x) ans++;
else ans+=s.size();
while(!s.empty()&&s.top()<x) s.pop();
s.push(x);
}
printf("%d",ans);
return 0;
}
过了样例,感觉思路也没问题,它还不让我解锁数据