import Data.List

large2pow::Int -> Int
large2pow 0 = 1
large2pow n = mod ((large2pow (n-1))*2) 1000000007

solver::Int -> Bool -> Int
solver _  False= 0
solver n  True = if mod n 2 ==0 then large2pow (div n 2) else large2pow (div (n-1) 2)

check::[Int]->Int -> Bool
check dat n
  | (mod n 2 == 0) = ([(2*i)-1|i<-[1..(div n 2)],j<-[0,1]]==(sort dat))
  | (mod n 2 == 1) = ([2*i|i<-[0..(div n 2)],j<-[0,1]]==(0:(sort dat)))


main::IO()
main=do
  nc<-getLine
  let n = read nc ::Int
  ac<-getLine
  let dat = map read (words ac) ::[Int]
  print (solver n (check dat n))
