program arc068
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int32):: n,cnt(1:100000),i
    integer(int32), allocatable:: a(:)

    read*, n
    allocate(a(n))
    read*, a(:)
    cnt(:) = 0
    do i=1,n
        cnt(a(i))=cnt(a(i))+1
    end do
    where (cnt > 0)
        cnt=cnt-1
    end where
    ! print'(*(i0,1x))', cnt(1:50)
    ! print'(i0)', sum(cnt(:))

    print'(i0)', n - 2*((sum(cnt))/2 + mod(sum(cnt),2))
end program arc068