#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     long long int a[n], p[n], s[n];     for (int i = 0; i < n; i++) {       cin >> a[i];     }     int blocks = 0;     p[0] = a[0];     for (int i = 1; i < n; i++) {       p[i] = max(p[i - 1], a[i]);     }     s[n - 1] = a[n - 1];     for (int i = n - 2; i >= 0; i--) {       s[i] = min(s[i + 1], a[i]);     }     for (int i = 0; i < n - 1; i++) {       if (p[i] <= s[i + 1]) {         blocks++;       }     }     cout << blocks + 1 << endl;   }   