program main
      implicit none
      integer :: n, i, j, mni
      integer(8) ::cnt
      integer, allocatable :: p(:)

      read *, n
      allocate( p(n) )
      read *, p

      cnt = 0
      mni = p(1)
      do i = 1, n
        if ( mni < p(i) ) then
        else
          cnt = cnt + 1
          mni = p(i)
        end if
      end do
      print *, cnt

end program main

