#include <bits/stdc++.h>
using namespace std;
const int N = 100001;
int H[N];
vector<int> st;
vector<pair<int, int> > xx;
int main() {
  int n;
  scanf("%d", &n);
  st.push_back(0);
  for (int i = 1; i < n + 1; i++) {
    scanf("%d", &H[i]);
    int lo = 0, hi = st.size() - 1;
    if (H[i] >= H[st.back()]) {
      if (H[i] != H[st.back()]) st.push_back(i);
      xx.push_back(make_pair(i, i));
    } else {
      int idx = -1;
      while (lo <= hi) {
        int mi = (lo + hi) >> 1;
        if (H[st[mi]] > H[i]) {
          idx = mi;
          hi = mi - 1;
        } else {
          lo = mi + 1;
        }
      }
      xx.push_back(make_pair(st[idx], i));
    }
  }
  sort(xx.begin(), xx.end());
  int x = xx[0].second;
  int ans = 1;
  for (int i = 1; i < xx.size(); i++) {
    if (xx[i].first > x) {
      ans++;
    }
    x = max(x, xx[i].second);
  }
  printf("%d\n", ans);
  return 0;
}
