#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
vector<int> pos(n + 1);
for(int i = 0; i < n; i++)
{
int x;
cin >> x;
pos[x] = i;
}
int l = n, r = 0;
int ans = 0;
for(int i = 1; i <= n; i++)
{
r = max(r, pos[i]);
l = min(l, pos[i]);
if(r - l + 1 == i)
ans++;
}
cout << ans << endl;
return 0;
}