#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A;
  int count = 0;
  cin >> A;
  int B[20];
  
  for (i = 0; i < A; i++)　{
    cin >> B[i];
  }
  for (i = 0; i < A; i++)　{
    if (B[i] <= B[i+1]) {
      count++
    }
    else 
      break;
  }
  		cout << count << endl; 
}