a.题目链接
b.题解
#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;
int main()
{
int n;
cin >> n;
vector<int>a(n,0);
for(auto &i:a)cin >> i;
int max_a = 0, min_a = 0;
for(int i = 0; i < n; i++){
if(a[max_a] < a[i])max_a = i;
if(a[min_a] >= a[i])min_a = i;
}
int t = 0;
if(max_a > min_a )t = max_a + n -1 - min_a - 1;
else t = max_a + n - 1 - min_a;
cout << t <<endl;
return 0;
}