import Control.Arrow
import Data.List
main = getLine >>= main' . read
    where
        main' n = getLine >>= print . solve n . map (head &&& length) . group . sort . map read . words

solve :: Int -> [(Int, Int)] -> Int
solve n xxs@(x : xs)
    | odd n && fst x == 0 && snd x == 1 && check 2 xs = calc $ (n - 1) `div` 2
    | even n && fst x /= 0 && check 1 xxs = calc $ n `div` 2
    | otherwise = 0
    where
        check p ((y, yl) : ys)
            | p == y && yl == 2 = check (p + 2) ys
            | otherwise = False
        check _ _ = True

        calc 0 = 1
        calc 1 = 2
        calc p
            | odd p = 2 * calc (p - 1) `mod` 1000000007
            | otherwise = prev * prev `mod` 1000000007
            where
                prev = calc $ p `div` 2
