#include <bits/stdc++.h>
using namespace std;
int a[212345], r[212345], b[212345], p[212345];
map<int, int> M;
void solve() {
  int n, i, curr, l;
  scanf("%d", &n);
  for (i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
    b[i] = a[i];
  }
  sort(b, b + n);
  int cnt = 0;
  for (i = 0; i < n; ++i) {
    if (M.find(b[i]) == M.end()) M[b[i]] = cnt++;
  }
  for (i = 0; i < n; ++i) {
    b[i] = M[b[i]];
    a[i] = M[a[i]];
  }
  for (i = 0; i < n; ++i) r[a[i]] = i;
  p[b[0]] = 0;
  curr = r[b[0]];
  for (i = 1; i < n; ++i) {
    if (b[i] == b[i - 1]) continue;
    p[b[i]] = curr;
    curr = max(curr, r[b[i]]);
  }
  int rs = 0;
  for (i = 0; i < n;) {
    ++rs;
    l = max(p[a[i]], i);
    for (; i <= l; ++i) {
      l = max(p[a[i]], l);
    }
  }
  cout << rs << endl;
}
int main() {
  int t = 1;
  while (t--) {
    solve();
  }
}
