local n = io.read("*n")
local t = {}
for i = 1, n do
  t[i] = 0
end
local a = {}
for i = 1, n do
  a[i] = 1 + io.read("*n")
end
local ev = n % 2 == 0
local impossible = false
for i = 1, n do
  if(ev) then
    if(a[i] % 2 == 1) then
      impossible = true
      break
    end
  else
    if(a[i] % 2 == 0) then
      impossible = true
      break
    end
  end
  if(a[i] == 1) then
    if(t[1] == 1) then
      impossible = true
      break
    end
  elseif(t[a[i]] == 2) then
    impossible = true
    break
  end
  t[a[i]] = t[a[i]] + 1
end
if(impossible) then
  print(0)
else
  local c = 1
  for i = 2, n do
    if(0 < t[i]) then c = (c * 2) % 1000000007 end
  end
  print(c)
end
