program main
    integer n, a(10**5)
    integer :: ans(10**5) = 0
    integer first, second

    read *, n
    read *, (a(i), i=1,n)

    do i = 1, n
        ans(a(i)) = ans(a(i)) + 1
    end do
    first = 0
    second = 0
    do i = 1, 10**5
        if(ans(i)/2 > 1) then
            first = i
            second = i
        elseif ( ans(i)/2 == 1 ) then
            second = first
            first = i
        end if
    end do
    print *, first*second
end program main