program sample
  implicit none
  integer(16) :: i,j,x,y,count,N
  integer(16),allocatable  :: a(:)
    
  read(*,*) N

  allocate(a(N))
  read(*,*) a

  do i=1,N
     do j=i,N
        if (a(i)<a(j)) then
           y=a(i)
           a(i)=a(j)
           a(j)=y
        end if
     end do
  end do

  count=1
  i=1

  do while(.true.)
     if (a(i)==a(i+1) .and. i<N-2) then
        count = count*a(i)
        i=i+2
     end if
     if (a(i)==a(i+1) .and. i==N-1) then
     	count=count*a(i)
        i=i+1
     end if
     if(i ==N) then
     	exit
     end if
     i=i+1
  end do
  
  write(*,*) count
  
  stop
end program sample