#include using namespace std; #define rep(i,n) for(int i=0;i=0;i--) #define fi first #define se second #define pb push_back #define sz(a) (int)a.size() #define vec(...) vector<__VA_ARGS__> #define _3HspL4A ios::sync_with_stdio(0),cin.tie(0) typedef long long ll; using pii=pair; using vi=vec(int); void print(){cout<<"\n";} template void print(const T&v,const E&...u){cout<>n; vi a(n); rep(i,n){ cin>>a[i]; } int l=0,r=0,ans=0; while(1){ int v=0; for(int i=l;i<=r;i++){ v=max(v,a[i]-1); } ans=ans+1; if(v==n-1){ break; } l=r; r=v; } print(ans); // return 0; }