 #include<iostream>
  2 using namespace std;
  3 int main(){
  4   int n;
  5   cin>>n;
  6   int a[n];
  7   for(int i=0;i<n;i++){
  8     cin>>a[i];
  9   }
 10   int SIL[10001];
 11   for(int i=0;i<10001;i++){
 12     SIL[i] = -1;
 13   }
 14   SIL[0] = 0;
 15   int c=0;
 16   for(int i=0;i<n;i++){
 17     if(SIL[c]<a[i]){
 18       c++;
 19       SIL[c]=a[i];
 20     }else if(SIL[c]>a[i]){
 21       SIL[c]=a[i];
 22     }
 23   }
 24   cout<<c<<endl;
 25 }