#include <bits/stdc++.h>
using namespace std;
int n;
long long a[100005];
long long int b[100005];
multiset<long long> cur, all;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    all.insert(a[i]);
  }
  int ans = 0;
  cur.clear();
  for (int i = 1; i <= n; i++) {
    if (cur.empty()) {
      cur.insert(a[i]);
      ans++;
      multiset<long long>::iterator it = all.lower_bound(a[i]);
      all.erase(it);
      continue;
    }
    multiset<long long>::iterator it1 = cur.end();
    it1--;
    if (*it1 <= *(all.begin())) {
      cur.clear();
      i--;
    } else {
      cur.insert(a[i]);
      multiset<long long>::iterator it = all.lower_bound(a[i]);
      all.erase(it);
    }
  }
  cout << ans << endl;
  return 0;
}
