import Data.Maybe
import Data.List
import Control.Monad

main = do :: IO String
  _  <- getLine
  an <- map read . words <$> getLine :: IO [Integer]
  let ans = fromMaybe (-1) $ foldM solve 1 $ sort an
  print ans;
  
solve :: Integer -> Integer -> Maybe Integer
solve a b
 | a * b <= 10 ^ 18 = Just (a * b)
 | otherwise = Nothing