local n=io.read("n")
local a_map={}
for i=(n%2==0 and 1 or 0),n,2 do
    a_map[i]=(i==0 and 1 or 2)
end

local a={}
for i=1,n do
    local input=io.read("n")
    a[input]=(a[input] or 0)+1
end

if #a~=#a_map then
    print(0)
    return
end

local counter=1
for k,v in pairs(a_map) do
    counter=(a[k]==a_map[k] and counter*v%1000000007 or 0)
end
print(counter)