#include <bits/stdc++.h>
using namespace std;
int main() {
  int h;
  cin >> h;
  int a[h], k[h];
  for (int i = 0; i < h; i++) {
    cin >> a[i];
    k[i] = a[i];
  }
  for (int i = 0; i < h - 1; i++) {
    if (a[i] > a[i + 1])
      ;
    a[i + 1] = a[i + 1] + (a[i] - a[i + 1]);
  }
  int c = 0;
  for (int i = 0; i < h - 1; i++) {
    if (a[i] != k[i])
      ;
    c = c + 1;
  }
  cout << c;
}
