program main
  implicit none
  integer :: n, i
  integer, allocatable :: a(:)
  read(*, *) n
  allocate(a(n))
  read(*, *) (a(i), i = 1, n)

  if (is_possible(a, n)) then
    write(*, "(i0)") cnt(n)
  else
    write(*, "(i0)") 0
  end if

  deallocate(a)
  contains

  pure function is_possible(a, n)
    implicit none
    integer, intent(in) :: n, a(:)
    integer :: i
    integer :: cnt(0:n - 1)
    logical :: is_possible
    is_possible = .true.
    cnt(:) = 0
    do i = 1, n
      cnt(a(i)) = cnt(a(i)) + 1
    end do
    if (mod(n, 2) == 0) then
      do i = n - 1, 1, -2
        if (cnt(i) /= 2) is_possible = .false.
      end do
    else
      do i = n - 1, 2, -2
        if (cnt(i) /= 2) is_possible = .false.
      end do
      if (cnt(0) /= 1) is_possible = .false.
    end if
  end function is_possible

  pure function cnt(n)
    implicit none
    integer, intent(in) :: n
    integer :: i, m, cnt
    integer, parameter :: md = 1000000007
    m = n / 2
    cnt = 1
    do i = 1, m
      cnt = mod(cnt * 2, md)
    end do
  end function cnt
end
