// Born_To_Laugh - Hughie Do
#include <bits/stdc++.h>
#define alle(AC) AC.begin(), AC.end()
#define fi first
#define se second
using namespace std;
typedef long long ll;
[[maybe_unused]] const ll MOD = 998244353, INF = 1e9 + 7;
const int maxn = 1e6 + 10;
struct fenwick{
int n;
vector<int> bit;
void init(int len){
n = len;
bit.assign(n + 1, 0);
}
fenwick(int len = 0){
init(len);
}
void upd(int pos, int val){
for(; pos<=n; pos += pos & -pos) bit[pos] += val;
}
int qr(int pos){
int ans = 0;
for(; pos>0; pos -= pos & -pos) ans += bit[pos];
return ans;
}
int qr(int l, int r){
if(r < l) return 0;
return qr(r) - qr(l - 1);
}
};
int n;
int a[maxn];
fenwick ft;
void solve(){
ft.init(1e6 + 3);
cin >> n;
for(int i=1; i<=n; ++i){
cin >> a[i];
ft.upd(a[i], 1);
}
int ans = 0;
for(int i=n - 1; i>=1; --i){
ft.upd(a[i], -1);
if(a[i] > a[i + 1]){
ans++;
continue;
}
else if(ft.qr(a[i] + 1, a[i + 1] - 1) > 0){
ans++;
}
}
cout << ans + 1 << '\n';
}
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
solve();
}