program sample
    implicit none
    character(100000)::s,t
    integer(8) :: i,j,k,m,n
    integer(8)::a,b,c,d
    integer(8),allocatable::x(:),y(:)
  
   
    read(*,*)n
    allocate(x(n),y(n))
    read(*,*)x
    m=0
    y(:)=0
    do i=1,n
        if(x(i)>n)then
            m=m+1
        else
            a=x(i)
            y(a)=y(a)+1
        endif
    end do
    do i=1,n
        if(y(i)>i)then
            m=m+y(i)-i
        elseif(y(i)<i)then
            m=m+y(i)
        end if
    end do
 
    write(*,*)m
    stop
end program sample
  

