N = int(eval(input()))

A = [int(x) for x in input().split()]



from collections import Counter



def f():

    cnt = Counter(A)

    m = N - 1

    for k, v in list(cnt.items()):

        if k == 0 and v == 1: continue

        if v != 2 or k > m:

            return 0

    return pow(2, N//2, 10**9 + 7)



print((f()))
N = int(eval(input()))

A = [int(x) for x in input().split()]



from collections import Counter

def f():

    cnt = Counter(A)

    m = N - 1

    for k, v in list(cnt.items()):

        if k == 0:

            if v == 1:

                continue

            else:

                return 0

        else:

            if v != 2 or k > m:

                return 0

    return pow(2, N//2, 10**9 + 7)



print((f()))
N = int(eval(input()))
A = [int(x) for x in input().split()]
from collections import Counter


def f():
    cnt = Counter(A)
    m = N - 1
    for k, v in list(cnt.items()):
        if k == 0 and v == 1:
            continue
        if v != 2 or k > m:
            return 0
    return pow(2, N // 2, 10**9 + 7)


print((f()))

N = int(eval(input()))
A = [int(x) for x in input().split()]
from collections import Counter


def f():
    cnt = Counter(A)
    m = N - 1
    for k, v in list(cnt.items()):
        if k == 0:
            if v == 1:
                continue
            else:
                return 0
        else:
            if v != 2 or k > m:
                return 0
    return pow(2, N // 2, 10**9 + 7)


print((f()))

-        if k == 0 and v == 1: -            continue -        if v != 2 or k > m: -            return 0 +        if k == 0: +            if v == 1: +                continue +            else: +                return 0 +        else: +            if v != 2 or k > m: +                return 0