#include <bits/stdc++.h>   using namespace std;   double __begin;   template <typename T1, typename T2, typename T3>   struct triple {     T1 a;     T2 b;     T3 c;     triple(){};     triple(T1 _a, T2 _b, T3 _c) : a(_a), b(_b), c(_c) {}   };   template <typename T1, typename T2, typename T3>   bool operator<(const triple<T1, T2, T3>& t1, const triple<T1, T2, T3>& t2) {     if (t1.a != t2.a)       return t1.a < t2.a;     else if (t1.b != t2.b)       return t1.b < t2.b;     else       return t1.c < t2.c;   }   template <typename T1, typename T2, typename T3>   inline std::ostream& operator<<(std::ostream& os, const triple<T1, T2, T3>& t) {     return os <<  (  << t.a <<  ,   << t.b <<  ,   << t.c <<  ) ;   }   inline int bits_count(int v) {     v = v - ((v >> 1) & 0x55555555);     v = (v & 0x33333333) + ((v >> 2) & 0x33333333);     return ((v + (v >> 4) & 0xF0F0F0F) * 0x1010101) >> 24;   }   inline int bits_count(long long v) {     int t = v >> 32;     int p = (v & ((1LL << 32) - 1));     return bits_count(t) + bits_count(p);   }   unsigned int reverse_bits(register unsigned int x) {     x = (((x & 0xaaaaaaaa) >> 1) | ((x & 0x55555555) << 1));     x = (((x & 0xcccccccc) >> 2) | ((x & 0x33333333) << 2));     x = (((x & 0xf0f0f0f0) >> 4) | ((x & 0x0f0f0f0f) << 4));     x = (((x & 0xff00ff00) >> 8) | ((x & 0x00ff00ff) << 8));     return ((x >> 16) | (x << 16));   }   inline int sign(int x) { return x > 0; }   inline bool isPowerOfTwo(int x) { return (x != 0 && (x & (x - 1)) == 0); }   template <typename T1, typename T2>   inline std::ostream& operator<<(std::ostream& os, const std::pair<T1, T2>& p) {     return os <<  (  << p.first <<  ,   << p.second <<  ) ;   }   template <typename T>   inline std::ostream& operator<<(std::ostream& os, const std::vector<T>& v) {     bool first = true;     os <<  [ ;     for (unsigned int i = 0; i < v.size(); i++) {       if (!first) os <<  ,  ;       os << v[i];       first = false;     }     return os <<  ] ;   }   template <typename T>   inline std::ostream& operator<<(std::ostream& os, const std::set<T>& v) {     bool first = true;     os <<  [ ;     for (typename std::set<T>::const_iterator ii = v.begin(); ii != v.end();          ++ii) {       if (!first) os <<  ,  ;       os << *ii;       first = false;     }     return os <<  ] ;   }   template <typename T1, typename T2>   inline std::ostream& operator<<(std::ostream& os, const std::map<T1, T2>& v) {     bool first = true;     os <<  [ ;     for (typename std::map<T1, T2>::const_iterator ii = v.begin(); ii != v.end();          ++ii) {       if (!first) os <<  ,  ;       os << *ii;       first = false;     }     return os <<  ] ;   }   template <typename T, typename T2>   void printarray(T a[], T2 sz, T2 beg = 0) {     for (T2 i = beg; i < sz; i++) cout << a[i] <<    ;     cout << endl;   }   inline long long mulmod(long long x, long long n, long long _mod) {     long long res = 0;     while (n) {       if (n & 1) res = (res + x) % _mod;       x = (x + x) % _mod;       n >>= 1;     }     return res;   }   inline long long powmod(long long x, long long n, long long _mod) {     long long res = 1;     while (n) {       if (n & 1) res = (res * x) % _mod;       x = (x * x) % _mod;       n >>= 1;     }     return res;   }   inline long long gcd(long long a, long long b) {     long long t;     while (b) {       a = a % b;       t = a;       a = b;       b = t;     }     return a;   }   inline int gcd(int a, int b) {     int t;     while (b) {       a = a % b;       t = a;       a = b;       b = t;     }     return a;   }   inline long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }   inline long long gcd(long long a, long long b, long long c) {     return gcd(gcd(a, b), c);   }   inline int gcd(int a, int b, int c) { return gcd(gcd(a, b), c); }   template <class T>   inline void cinarr(T& a, int n) {     for (int i = 0; i < n; ++i) cin >> a[i];   }   int main() {     int n, c_mx = -1, c_mn = 1e9, ans = 0;     scanf( %d , &n);     vector<int> a(n), p(n), s(n);     for (int i = 0; i < (n); ++i) scanf( %d , &a[i]);     for (int i = 0; i < (n); ++i) {       if (a[i] > c_mx) c_mx = a[i];       p[i] = c_mx;     }     for (int i = (n)-1; i >= (0); --i) {       if (a[i] < c_mn) c_mn = a[i];       s[i] = c_mn;     }     for (int i = 0; i < (n - 1); ++i) ans += (p[i] <= s[i + 1]);     printf( %d , ans + 1);     return 0;   }