/*
   .
   Author :- Gaurang_Kothiya
   .
   .
   .
   .
     _______.     ___      .______                                               
    /       |    /   \     |   _  \                                              
   |   (----`   /  ^  \    |  |_)  |                                             
    \   \      /  /_\  \   |   _  <                                              
.----)   |    /  _____  \  |  |_)  |                                             
|_______/    /__/     \__\ |______/                                              
                                                                                 
.___  ___.   ______    __    __     .___  ___.      ___   ____    ____  ___      
|   \/   |  /  __  \  |  |  |  |    |   \/   |     /   \  \   \  /   / /   \     
|  \  /  | |  |  |  | |  |__|  |    |  \  /  |    /  ^  \  \   \/   / /  ^  \    
|  |\/|  | |  |  |  | |   __   |    |  |\/|  |   /  /_\  \  \_    _/ /  /_\  \   
|  |  |  | |  `--'  | |  |  |  |    |  |  |  |  /  _____  \   |  |  /  _____  \  
|__|  |__|  \______/  |__|  |__|    |__|  |__| /__/     \__\  |__| /__/     \__\ 
                                                                                 
 __    __       ___       __                                                     
|  |  |  |     /   \     |  |                                                    
|  |__|  |    /  ^  \    |  |                                                    
|   __   |   /  /_\  \   |  |                                                    
|  |  |  |  /  _____  \  |  |  __                                                
|__|  |__| /__/     \__\ |__| (__)                                                                                                                                                                                 
   .
   .
   .
   .                                                                                                                                                        
                                                                                                                    
*/
 
 
#include<bits/stdc++.h>
using namespace std;
 
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define ll long long  
#define ld long double
#define f(i,x,n) for(ll i=x;i<=n;i++)
#define fe(x,v)   for(auto &x :v)
#define nf(i,x,n) for(ll i=n;i>=x;i--)
#define all(a)   a.begin(),a.end()
#define b_s(a,b)   binary_search( all(a),b)
#define lb(v,n)  lower_bound(all(v) ,n )
#define ub(v,n)  upper_bound( all(v) , n)
#define gcd(a,b) __gcd(a,b)
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define B begin()
#define E end()
#define acc(v, x) accumulate(all(v), x)
#define p(a,b) pair<a,b>
#define F first
#define S second
#define sz size()
#define v(x) vector<x>
#define m(a,b) map<a,b>
#define u_m(a,b) unordered_map<a,b>
#define mm(a,b) multimap<a,b>
#define s(a) set<a>
#define us(a) unordered_set<a>
#define ms(a) multiset<a>
#define maxy __LONG_LONG_MAX__
#define miny INT_MIN
#define PI 3.14159265358979323846
#define MOD 1000000007


signed main()
{
    speed;

    ll n;
    cin>>n;

    ll a[n],maxr[n-1];
    f(i,0,n-1) 
    {
        cin>>a[i];
        if(i==0) maxr[i]=a[i];
        else maxr[i]= min(maxr[i-1],a[i-1]);
    } 

    ll ans=0;
    f(i,0,n-1)
    {
        if( maxr[i]>= a[i])ans++;
    } 

    cout<< ans;


    //cout << "\n\n"<<"Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " seconds.\n";
    return 0;
}

Measured memory_bytes: 3328