#include <bits/stdc++.h>
using namespace std;
const long double eps = 1e-9;
const long double pi = acos(-1.0);
const int inf = 1e+9;
#pragma comment(linker, "/STACK:99999999999")
template <typename T>
istream &operator>>(istream &, vector<T> &);
template <typename T>
ostream &operator<<(ostream &, const vector<T> &);
void solve() {
  int n;
  scanf("%d", &n);
  vector<int> a(n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  vector<int> b = a;
  sort((b).begin(), (b).end());
  b.erase(unique((b).begin(), (b).end()), b.end());
  for (int i = 0; i < n; i++)
    a[i] = lower_bound((b).begin(), (b).end(), a[i]) - b.begin();
  vector<int> c = a;
  sort((c).begin(), (c).end());
  vector<int> dif(b.size());
  int sz = 0;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (dif[a[i]] == 0) sz++;
    dif[a[i]]++;
    if (dif[a[i]] == 0) sz--;
    if (dif[c[i]] == 0) sz++;
    dif[c[i]]--;
    if (dif[c[i]] == 0) sz--;
    if (sz == 0) ans++;
  }
  cout << ans << endl;
  return;
}
int main() {
  clock_t _clock = clock();
  ;
  solve();
  return 0;
}
template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
  for (int i = 0; i < v.size(); ++i) {
    is >> v[i];
  }
  return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  for (int i = 0; i < v.size(); ++i) {
    if (i) os << " ";
    os << v[i];
  }
  return os;
}
