import Control.Applicative
import Data.List

power2 :: Integer -> Integer
power2 0 = 1
power2 n = 2 * (power2 $ n - 1)

check :: Integer -> [Integer] -> Integer
check n lst = 
    let validate_odd :: Integer -> [Integer] -> Bool
        validate_odd m [] = False
        validate_odd m [a] = if a == 0 then True else False
        validate_odd m (x:y:rest) = if m == x && m == y then validate_odd (m - 2) rest else False
        validate_even m [] = True
        validate_even m [_] = False
        validate_even m (x:y:rest) = if m == x && m == y then validate_even (m - 2) rest else False
        validate :: Bool
        validate = if mod n 2 == 0 then validate_even (n - 1) lst else validate_odd (n - 1) lst
        in if validate then power2 (div n 2) else 0

main = print =<< check <$> ((\a -> read a :: Integer) <$> getLine) <*> (reverse . sort . ((map (\a -> read a :: Integer)) . words) <$> getLine)
