#include<bits/stdc++.h>

using namespace std;

long long n, a[1000005], res = 0;

int main(){
    cin >>  n;
    for(long long i = 1; i <= n; i++) cin >> a[i];
    for(long long i = 1; i <= n; i++){
        if(a[i] == i){
            res++;
            swap(a[i], a[i + 1]);
        }
    }
    cout << res;
}
