program prob4
    implicit none
    integer :: i, N, ans, tmp
    integer :: a(100005)
    integer, allocatable :: r(:)
    read(*,*) N
    allocate(r(N))
    read(*,*) r
    ans = 0
    do i = 1, N
        tmp = r(i)
        if(tmp >= 100001)then
            ans = ans + 1
        else
            a(tmp) = a(tmp) + 1
        end if
    end do

    do i = 1, 100005
        if(a(i) < i) then
            ans = ans + a(i)
        else
            ans = ans + a(i) - i
        end if
    end do

    write(*,*) ans

    deallocate(r)
    stop
contains
end program prob4