#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
}
