import Data.List
import Data.Bool

main = print . solve . map read . drop 1 . words =<< getContents

solve :: [Int] -> Int
solve as
    | (odd $ length as) && length a' == 1 && a == 0 = bool 0 r . ssolve 2 $ tail as'
    | otherwise = bool 0 r $ ssolve 1 as'
    where
        a = head a'
        a' = head as'
        as' = group $ sort as
        r = (2^) . bool (length as') (length as' - 1) $ odd (length as)

ssolve n as = all (\(a,x) -> length a == 2 && head a == x) $ zip as [n,n+2..]
