#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
int current=0; // declare current 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]){
current = current + 1; // increase current by one
}
result = result + current; // increase result by current
}
cout<<n-result<<'\n'; // write n-result to the output
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbWFpbigpewoJaW50IG47IC8vIGRlY2xhcmUgbiB0byBiZSBhIG51bWJlcgoJY2luPj5uOyAvLyByZWFkIG4gZnJvbSB0aGUgaW5wdXQKCS8vIGRlY2xhcmUgImJvb2tzIiB0byBiZSBhIHNlcXVlbmNlIG9mIG51bWJlcnMgb2YgbGVuZ3RoIG46Cgl2ZWN0b3I8aW50PiBib29rcyhuKTsKCWZvcihpbnQgaT0wO2k8bjtpPWkrMSkKCQljaW4+PmJvb2tzW2ldOyAvLyByZWFkIGJvb2tzIGZyb20gdGhlIGlucHV0CglpbnQgcmVzdWx0PTA7IC8vIGRlY2xhcmUgcmVzdWx0IHRvIGJlIGEgbnVtYmVyIHdoaWNoIGlzIGluaXRpYWxseSAwCglpbnQgY3VycmVudD0wOyAvLyBkZWNsYXJlIGN1cnJlbnQgdG8gYmUgYSBudW1iZXIgd2hpY2ggaXMgaW5pdGlhbGx5IDAKCWZvcihpbnQgaT0wO2k8bi0xO2k9aSsxKXsgLy8gZm9yIGVhY2ggaSBmcm9tIDAgdG8gbi0yIGluIHR1cm4KCQkvLyBpZiB0aGUgbnVtYmVyIG9mIHRoZSBib29rIGF0IHBvc2l0aW9uIGkrMSBpcyBzbWFsbGVyCgkJLy8gdGhhbiB0aGUgbnVtYmVyIG9mIHR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