vv#include "bits/stdc++.h"
using namespace std;
const int MOD = 1e9 + 7;
typedef long long lint;
const int INF =1e7;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repi(i, k, n) for (int i = (k); i < (int)(n); ++i)
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(),(x).end()
#define pb push_back
int main(){
    int n;
    cin >> n;
    vi v(n);
    rep(i,n){
        cin >> v[i];
    }
    int ans = 0;
    rep(i, n)
    {
        if(v[i]==i+1){
            ans++;
            i++;
        }
    }
    cout << ans << endl;
    return 0;
}