program kagami
  implicit none
  integer i,j,n,max_size,ans
  integer,allocatable :: d_i(:)

  read(*,*)n
  allocate(d_i(n))
  d_i=0
  do i=1,n
     read(*,*) d_i(i)
  end do

  ans=0
  do i=1,n
     max_size=maxval(d_i)
     if(max_size == 0) exit
     ans=ans+1
     do j=1,n
        select case (d_i(j)-max_size)
        case (0)
           d_i(j)=0
        end select
     end do
  end do

  write(*,*) ans
end program kagami
