#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n;
  cin >> n;
  long long arr[n], brr[n];
  deque<long long> q;
  map<long long, set<long long>> mp;
  for (long long i = 0; i < n; i++) {
    cin >> arr[i];
    mp[arr[i]].insert(i);
    brr[i] = arr[i];
  }
  sort(brr, brr + n);
  long long ans = 0;
  long long ind = -1, red = 0;
  long long num = 0;
  for (long long i = 0; i < n; i++) {
    if (ind < *mp[brr[i]].begin()) {
      ind = *mp[brr[i]].begin();
      num = brr[i];
    }
    long long x = *mp[brr[i]].begin();
    mp[brr[i]].erase(x);
    if (ind == i) {
      ans++;
      ind = 0;
    }
  }
  cout << ans << '\n';
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
  return 0;
}
