#include <bits/stdc++.h>
using namespace std;
int main(){
int n; // declare n to be a number
cin>>n; // read n from the input
// declare "books" to be a sequence of numbers of length n:
vector<int> books(n);
for(int i=0;i<n;i=i+1)
cin>>books[i]; // read books from the input
int result=0; // declare result to be a number which is initially 0
for(int i=0;i<n-1;i=i+1){ // for each i from 0 to n-2 in turn
// if the number of the book at position i+1 is smaller
// than the number of the book at position i:
if(books[i+1]<books[i]){
result=result+1; // increase the result by one
}else{ // otherwise
result=0; // reset the result to 0
}
}
cout<<n-result<<'\n'; // write n-result to the output
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbWFpbigpewoJaW50IG47IC8vIGRlY2xhcmUgbiB0byBiZSBhIG51bWJlcgoJY2luPj5uOyAvLyByZWFkIG4gZnJvbSB0aGUgaW5wdXQKCS8vIGRlY2xhcmUgImJvb2tzIiB0byBiZSBhIHNlcXVlbmNlIG9mIG51bWJlcnMgb2YgbGVuZ3RoIG46Cgl2ZWN0b3I8aW50PiBib29rcyhuKTsKCWZvcihpbnQgaT0wO2k8bjtpPWkrMSkKCQljaW4+PmJvb2tzW2ldOyAvLyByZWFkIGJvb2tzIGZyb20gdGhlIGlucHV0CglpbnQgcmVzdWx0PTA7IC8vIGRlY2xhcmUgcmVzdWx0IHRvIGJlIGEgbnVtYmVyIHdoaWNoIGlzIGluaXRpYWxseSAwCglmb3IoaW50IGk9MDtpPG4tMTtpPWkrMSl7IC8vIGZvciBlYWNoIGkgZnJvbSAwIHRvIG4tMiBpbiB0dXJuCgkJLy8gaWYgdGhlIG51bWJlciBvZiB0aGUgYm9vayBhdCBwb3NpdGlvbiBpKzEgaXMgc21hbGxlcgoJCS8vIHRoYW4gdGhlIG51bWJlciBvZiB0aGUgYm9vayBhdCBwb3NpdGlvbiBpOgoJCWlmKGJvb2tzW2krMV08Ym9va3NbaV0pewoJCQlyZXN1bHQ9cmVzdWx0KzE7IC8vIGluY3JlYXNlIHRoZSByZXN1bHQgYnkgb25lCgkJfWVsc2V7IC8vIG90aGVyd2lzZQoJCQlyZXN1bHQ9MDsgLy8gcmVzZXQgdGhlIHJlc3VsdCB0byAwCgkJfQoJfQoJY291dDw8bi1yZXN1bHQ8PCdcbic7IC8vIHdyaXRlIG4tcmVzdWx0IHRvIHRoZSBvdXRwdXQKfQo=