integer N
integer,allocatable,dimension(:)::A,B
integer::mo=10**9+7
integer ans
logical ABsame
read*,N
allocate(A(N),B(N))
read*,A
call Heapsort(N,A)
select case(mod(N,2))
  case(1) 
    B(1)=0
    do i=1,N/2
      B(2*i)=i*2
      B(2*i+1)=i*2
    end do
  case(0)
    do i=1,N/2
      B(2*i-1)=2*i-1
      B(2*i)=2*i-1
    end do
end select
ABsame=.True.
do i=1,N
  if(A(i)/=B(i))ABsame=.false.
end do


if(ABsame)then
  ans=1
  do i=1,N/2
    ans=mod(ans*2,mo)
  end do
  print"(i0)",ans
else
  print"(i0)",0
endif
contains
subroutine heapsort(n,array)
  implicit none
!ここの入力は状況に応じて変更すること
  integer,intent(in) :: n
  integer,intent(inout) :: array(1:n)
  integer::i,k,j,l
  integer:: t

  l=n/2+1
  k=n
  do while(k /= 1)
     if(l > 1)then
        l=l-1
        t=array(L)
     else
        t=array(k)
        array(k)=array(1)
        k=k-1
        if(k == 1) then
           array(1)=t
           exit
        endif
     endif
     i=l
     j=l+l
     do while(j<=k)
        if(j < k)then
           if(array(j) < array(j+1))j=j+1
        endif
        if (t < array(j))then
           array(i)=array(j)
           i=j
           j=j+j
        else
           j=k+1
        endif
     enddo
     array(i)=t
  enddo
  return
end subroutine heapsort
end