#include #define rep(i,n) for(int i = 0; i < (n); i++) using namespace std; typedef long long ll; int main(){ cin.tie(0); ios::sync_with_stdio(0); int N; cin >> N; vector A(N); rep(i,N) cin >> A[i]; vector> V(N); rep(i,N) V[i] = {A[i], i}; sort(V.begin(), V.end()); vector st(N + 1, 0); int ans = 0; rep(i,N) { auto [a, b] = V[i]; if(st[b + 1] == 0) { st[b] = 1; ans++; } } cout << ans << endl; }