integer N
integer cnt
integer,allocatable,dimension(:)::mins
integer A
read*,N
read*,A
mins=[A]
cnt=1
do i=2,N
  read*,A
  if(A>mins(1))then
    do j=size(mins),1,-1
      if(mins(j)<A)then
        mins(J)=A
        exit
      endif
    end do
  else
    mins=[A,mins]
    cnt=cnt+1
  end if
end do
print"(I0)",cnt
end