program ABC_085_B_KagamiMochi
   integer N, i, dm, m, countN
   integer, allocatable :: d(:)
   read(*, *) N
   allocate(d(1: N))
   read(*, *) d(1: N)
   do i = 1, N - 1
      dm = maxval(d(i+1:N))
	  m  = maxloc(d(i+1:N), 1) + i
	  if (d(i) < dm) then
	      d(m) = d(i)
		  d(i) = dm
	  end if
   end do
   countN = 1
   do i = 1, N - 1
       if(d(i) > maxval(d(i+1: N))) then
	      countN = countN + 1
	   end if
   end do
   write(*, *) countN
end program ABC_085_B_KagamiMochi