import collections



n = int(eval(input()))

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

ac = collections.Counter(a)

if n % 2:

    if ac[0] != 1:

        print((0))

        exit()

    for i in ac:

        if i == 0:

            continue

        if ac[i] != 2:

            print((0))

            exit()

else:

    if ac[1] != 2:

        print((0))

        exit()

    for i in ac:

        if i == 1:

            continue

        if ac[i] != 2:

            print((0))

            exit()

mod = 10 ** 9 + 7

print(((2 ** (n // 2)) % mod))
import collections



n = int(eval(input()))

mod = 10 ** 9 + 7

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

ac = collections.Counter(a)

if n % 2:

    for i in list(ac.items()):

        if i[0] == 0:

            if i[1] != 1:

                print((0))

                exit()

        else:

            if i[1] != 2:

                print((0))

                exit()

    print((2 ** (n // 2) % mod))

else:

    for i in list(ac.values()):

        if i != 2:

            print((0))

            exit()

    print((2 ** (n // 2) % mod))
import collections

n = int(eval(input()))
a = list(map(int, input().split()))
ac = collections.Counter(a)
if n % 2:
    if ac[0] != 1:
        print((0))
        exit()
    for i in ac:
        if i == 0:
            continue
        if ac[i] != 2:
            print((0))
            exit()
else:
    if ac[1] != 2:
        print((0))
        exit()
    for i in ac:
        if i == 1:
            continue
        if ac[i] != 2:
            print((0))
            exit()
mod = 10**9 + 7
print(((2 ** (n // 2)) % mod))

import collections

n = int(eval(input()))
mod = 10**9 + 7
a = list(map(int, input().split()))
ac = collections.Counter(a)
if n % 2:
    for i in list(ac.items()):
        if i[0] == 0:
            if i[1] != 1:
                print((0))
                exit()
        else:
            if i[1] != 2:
                print((0))
                exit()
    print((2 ** (n // 2) % mod))
else:
    for i in list(ac.values()):
        if i != 2:
            print((0))
            exit()
    print((2 ** (n // 2) % mod))

+mod = 10**9 + 7 -    if ac[0] != 1: -        print((0)) -        exit() -    for i in ac: -        if i == 0: -            continue -        if ac[i] != 2: +    for i in list(ac.items()): +        if i[0] == 0: +            if i[1] != 1: +                print((0)) +                exit() +        else: +            if i[1] != 2: +                print((0)) +                exit() +    print((2 ** (n // 2) % mod)) +else: +    for i in list(ac.values()): +        if i != 2: -else: -    if ac[1] != 2: -        print((0)) -        exit() -    for i in ac: -        if i == 1: -            continue -        if ac[i] != 2: -            print((0)) -            exit() -mod = 10**9 + 7 -print(((2 ** (n // 2)) % mod)) +    print((2 ** (n // 2) % mod))