n = int(eval(input()))

A = list(map(int, input().split()))

mod = 10**9+7



if n%2 == 1:

    m = (n+1)//2

    l =[0]*m

    for i in range(n):

        if (n-A[i]-1)%2 != 0:

            print((0))

            exit()

        else:

            id = (n-A[i]-1)//2

            l[id] += 1

    #print(l)

    ans = 1

    for i in range(m):

        #print(i, ans)

        if i != m -1:

            if l[i] != 2:

                print((0))

                exit()

            else:

                ans *= l[i]

                ans %= mod

        else:

            if l[i] != 1:

                print((0))

                exit()

            else:

                ans *= l[i]

                ans %= mod

    print(ans)



else:

    m = n//2

    l =[0]*m

    for i in range(n):

        if (n-A[i]-1)%2 != 0:

            print((0))

            exit()

        else:

            id = (n-A[i]-1)//2

            l[id] += 1

    #print(l)

    ans = 1

    for i in range(m):

        #print(i, ans)

        if l[i] != 2:

            print((0))

            exit()

        else:

            ans *= l[i]

            ans %= mod

    print(ans)
n = int(eval(input()))

A = list(map(int, input().split()))



mod = 10**9+7



def power(a, n, mod):

    bi=str(format(n,"b")) #2進数

    res=1

    for i in range(len(bi)):

        res=(res*res) %mod

        if bi[i]=="1":

            res=(res*a) %mod

    return res





from collections import Counter

if n%2 == 0:

    C = Counter(A)

    for i in range(1, n+1):

        if i%2 == 0:

            continue

        else:

            if C[i] != 2:

                print((0))

                exit()

    else:

        print((power(2, n//2, mod)))

else:

    C = Counter(A)

    for i in range(1, n+1):

        if i == 0:

            if C[i] != 1:

                print((0))

                exit()

        elif i%2 == 1:

            continue

        else:

            if C[i] != 2:

                print((0))

                exit()

    else:

        print((power(2, n//2, mod)))

n = int(eval(input()))
A = list(map(int, input().split()))
mod = 10**9 + 7
if n % 2 == 1:
    m = (n + 1) // 2
    l = [0] * m
    for i in range(n):
        if (n - A[i] - 1) % 2 != 0:
            print((0))
            exit()
        else:
            id = (n - A[i] - 1) // 2
            l[id] += 1
    # print(l)
    ans = 1
    for i in range(m):
        # print(i, ans)
        if i != m - 1:
            if l[i] != 2:
                print((0))
                exit()
            else:
                ans *= l[i]
                ans %= mod
        else:
            if l[i] != 1:
                print((0))
                exit()
            else:
                ans *= l[i]
                ans %= mod
    print(ans)
else:
    m = n // 2
    l = [0] * m
    for i in range(n):
        if (n - A[i] - 1) % 2 != 0:
            print((0))
            exit()
        else:
            id = (n - A[i] - 1) // 2
            l[id] += 1
    # print(l)
    ans = 1
    for i in range(m):
        # print(i, ans)
        if l[i] != 2:
            print((0))
            exit()
        else:
            ans *= l[i]
            ans %= mod
    print(ans)

n = int(eval(input()))
A = list(map(int, input().split()))
mod = 10**9 + 7


def power(a, n, mod):
    bi = str(format(n, "b"))  # 2進数
    res = 1
    for i in range(len(bi)):
        res = (res * res) % mod
        if bi[i] == "1":
            res = (res * a) % mod
    return res


from collections import Counter

if n % 2 == 0:
    C = Counter(A)
    for i in range(1, n + 1):
        if i % 2 == 0:
            continue
        else:
            if C[i] != 2:
                print((0))
                exit()
    else:
        print((power(2, n // 2, mod)))
else:
    C = Counter(A)
    for i in range(1, n + 1):
        if i == 0:
            if C[i] != 1:
                print((0))
                exit()
        elif i % 2 == 1:
            continue
        else:
            if C[i] != 2:
                print((0))
                exit()
    else:
        print((power(2, n // 2, mod)))

-if n % 2 == 1: -    m = (n + 1) // 2 -    l = [0] * m -    for i in range(n): -        if (n - A[i] - 1) % 2 != 0: -            print((0)) -            exit() + + +def power(a, n, mod): +    bi = str(format(n, "b"))  # 2進数 +    res = 1 +    for i in range(len(bi)): +        res = (res * res) % mod +        if bi[i] == "1": +            res = (res * a) % mod +    return res + + +from collections import Counter + +if n % 2 == 0: +    C = Counter(A) +    for i in range(1, n + 1): +        if i % 2 == 0: +            continue -            id = (n - A[i] - 1) // 2 -            l[id] += 1 -    # print(l) -    ans = 1 -    for i in range(m): -        # print(i, ans) -        if i != m - 1: -            if l[i] != 2: +            if C[i] != 2: -            else: -                ans *= l[i] -                ans %= mod -        else: -            if l[i] != 1: +    else: +        print((power(2, n // 2, mod))) +else: +    C = Counter(A) +    for i in range(1, n + 1): +        if i == 0: +            if C[i] != 1: -            else: -                ans *= l[i] -                ans %= mod -    print(ans) -else: -    m = n // 2 -    l = [0] * m -    for i in range(n): -        if (n - A[i] - 1) % 2 != 0: -            print((0)) -            exit() +        elif i % 2 == 1: +            continue -            id = (n - A[i] - 1) // 2 -            l[id] += 1 -    # print(l) -    ans = 1 -    for i in range(m): -        # print(i, ans) -        if l[i] != 2: -            print((0)) -            exit() -        else: -            ans *= l[i] -            ans %= mod -    print(ans) +            if C[i] != 2: +                print((0)) +                exit() +    else: +        print((power(2, n // 2, mod)))