program main
implicit none
character*16 :: a
integer :: n,i,j,x,y,z,m
integer,allocatable :: p(:)

read(*,*)n
allocate(p(n))
read(*, *)(p(i), i = 1,n)

z=0

m = maxval(p(:))
do i=1,n
x=0
y=0
do j=1,n
if(p(j) >= i) then
x = x+1
else if (p(j) < i) then
y = y+1
end if
end do
if(x == y) z = z+1
end do

write(*,*) z

end program main