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

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

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