#include <bits/stdc++.h>
using namespace std;
long long m, n, i, j, a[100005], ans;
map<long long, long long> mp;
struct dd {
  long long vl, pos;
};
dd b[100005];
bool cm(const dd p, const dd q) { return p.vl < q.vl; }
long long tree[100005];
void update(long long vl, long long pp) {
  while (pp <= j) {
    tree[pp] += vl;
    pp += (pp & -pp);
  }
}
long long read(long long pp) {
  long long s = 0;
  while (pp > 0) {
    s += tree[pp];
    pp -= (pp & -pp);
  }
  return s;
}
int main() {
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> b[i].vl;
    b[i].pos = i;
  }
  sort(b, b + n, cm);
  a[b[0].pos] = 1;
  j = 1;
  for (i = 1; i < n; i++) {
    if (b[i].vl != b[i - 1].vl)
      a[b[i].pos] = ++j;
    else
      a[b[i].pos] = j;
  }
  for (i = 0; i < n; i++) update(1, a[i]);
  long long mx = 0;
  for (i = 0; i < n; i++) {
    if (mx == 0) {
      mx = a[i];
      ans++;
    } else if (a[i] < mx)
      update(-1, a[i]);
    else if (a[i] >= mx) {
      if (read(mx - 1) == 0) ans++;
      update(-1, mx);
      mx = a[i];
    }
  }
  cout << ans;
}
