program prob6
    implicit none
    integer(8)::N, i, s
    integer, allocatable::A(:)
    integer::c(100000)
    read(*,*) N
    allocate(A(N))
    read(*,*) A

    c = 0
    s = 0

    do i = 1, N
        c(A(i)) = c(A(i)) + 1
    end do

    do i = 1, N
        if(c(i) > 1)then
            s = s + c(i) - 1
        end if
    end do

    if(mod(s,2) == 1)then
        s = s+1
    end if
    write(*,*) N - s

    deallocate(A)
    stop
end program