#include <iostream>
using namespace std;

int a[200006];

// int bm(int d, int index){
// 	int temp = d;
// 	for(int i = index; i <= temp; i++){
// 		if(a[i] > temp){
// 			temp = a[i];
// 		}
// 	}
// }

int main() {
	int n; cin>>n;
	for(int i = 1; i <= n; i++){
		cin>>a[i];
	}
	int cnt = 0;
	int t = 1;
	while(t <= n){
		if(a[t] == t){
			cnt++;
			t++;
		}else
		if(a[t] != t){
			int temp = a[t];
			for(int j = t; j <= temp; j++){
				if(a[j] > temp){
					temp = a[j];
				}
			}
			t = temp;
		}
	}
	cout<<cnt;
	return 0;
}