import Data.List
import Data.Ord
 
main = interact $ show . sol . get

get = map (map read . words) . lines

sol [[n],as] = if check n (sortBy (flip compare) as) then pow2 (n`div`2) else 0

check n []          = n==0
check n [a]         = n==1 && a==0
check n (a0:a1:as)  = a0==n-1 && a1==n-1 && check (n-2) as

p = 10^9+7 :: Int

pow2 n
  | n == 0    = 1
  | odd n     = 2*r `mod` p
  | otherwise = r
  where
  q = pow2 (n `div` 2)
  r = q*q `mod` p