{-# LANGUAGE TypeApplications #-}
import qualified Data.ByteString.Char8 as BS
import qualified Data.ByteString.Char8 as B
import Data.Maybe
import Data.List
import Control.Monad

readInt = readLn :: IO Int
readIntegers = map ( fst . fromJust . B.readInteger ) . B.words <$> B.getLine

main :: IO ()
main = do
  n <- readInt
  as <- sort <$> readIntegers
  print $ fromMaybe (-1) $ foldM f 1 as
    where
      f :: Integer -> Integer -> Maybe Integer
      f a b
        | a * b <= 10 ^ 18 = Just $ a * b
        | otherwise = Nothing
