#include <bits/stdc++.h>
using namespace std ;

int main() {
	int N;
	cin >> N;
	vector <int> height;
	bool ans = True;
	int count = 0;
	cin >> vector <int> height;
	for(int i = 0;i < N;i++){
	if(heght.at(i) > height.at(i +1)){
	count++;
	}else	{ans = False;
	break;
}
}
cout << count << endl;
}
