import Data.List

main = do
	_ <- getLine
	xs <- map read.words <$> getLine :: IO [Int]
	putStrLn.show $ calc (isSolvable $ sort xs) (length xs `div` 2)

isSolvable xs@(v:vs)
	| length xs == 0 = False
	| length xs == 1 = v == 0
	| even (length xs) = v == 1 && third (foldl isCountinuous (v,1,True) vs)
	| odd (length (v:vs)) = v == 0 && head vs == 2 && third (foldl isCountinuous (head vs,1, True) $ tail vs)

isCountinuous (v,i,flag) x 
	| v == x && i == 1 = (x,2,flag)
	| v == x-2 && i == 2 = (x,1,flag)
	| otherwise = (x,0,False)

third (_,_,v) = v

calc False _ = 0
calc True v = 2^v `mod` (10^9+7)