i=input

n=int(i())

print(([0,pow(2,n//2,10**9+7)][sorted(i().split(),key=int)==[str((j+n%2)//2*2+1-n%2)for j in range(n)]]))
i=input

n=int(i())

print(([0,pow(2,n//2,10**9+7)][sorted(map(int,i().split()))==[(j+n%2)//2*2+1-n%2for j in range(n)]]))
i = input
n = int(i())
print(
    (
        [0, pow(2, n // 2, 10**9 + 7)][
            sorted(i().split(), key=int)
            == [str((j + n % 2) // 2 * 2 + 1 - n % 2) for j in range(n)]
        ]
    )
)

i = input
n = int(i())
print(
    (
        [0, pow(2, n // 2, 10**9 + 7)][
            sorted(map(int, i().split()))
            == [(j + n % 2) // 2 * 2 + 1 - n % 2 for j in range(n)]
        ]
    )
)

-            sorted(i().split(), key=int) -            == [str((j + n % 2) // 2 * 2 + 1 - n % 2) for j in range(n)] +            sorted(map(int, i().split())) +            == [(j + n % 2) // 2 * 2 + 1 - n % 2 for j in range(n)]