from functools import reduce



if __name__ == "__main__":

    n = int(eval(input()))

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

    x = [0]*n

    if n % 2 == 0:

        for i in a:

            if i % 2 != 1:

                print((0))

                exit()

    else:

        for i in a:

            if i % 2 != 0:

                print((0))

                exit()

    for i in a:

        if i == 0 and x[i] == 1:

            print((0))

            exit()

        elif x[i] == 2:

            print((0))

            exit()

        else:

            x[i] += 1

    print((reduce(lambda x, y: x * y if y != 0 else x, x, 1) % (10 ** 9 + 7)))
from functools import reduce



if __name__ == "__main__":

    n = int(eval(input()))

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

    x = [0]*n

    """if n % 2 == 0:

        for i in a:

            if i % 2 != 1:

                print(0)

                exit()

    else:

        for i in a:

            if i % 2 != 0:

                print(0)

                exit()"""

    for i in a:

        if i == 0 and x[i] == 1:

            print((0))

            exit()

        elif x[i] == 2:

            print((0))

            exit()

        else:

            x[i] += 1

    print((reduce(lambda x, y: x * y if y != 0 else x, x, 1) % (10 ** 9 + 7)))
from functools import reduce

if __name__ == "__main__":
    n = int(eval(input()))
    a = [int(x) for x in input().split()]
    x = [0] * n
    if n % 2 == 0:
        for i in a:
            if i % 2 != 1:
                print((0))
                exit()
    else:
        for i in a:
            if i % 2 != 0:
                print((0))
                exit()
    for i in a:
        if i == 0 and x[i] == 1:
            print((0))
            exit()
        elif x[i] == 2:
            print((0))
            exit()
        else:
            x[i] += 1
    print((reduce(lambda x, y: x * y if y != 0 else x, x, 1) % (10**9 + 7)))

from functools import reduce

if __name__ == "__main__":
    n = int(eval(input()))
    a = [int(x) for x in input().split()]
    x = [0] * n
    """if n % 2 == 0:
        for i in a:
            if i % 2 != 1:
                print(0)
                exit()
    else:
        for i in a:
            if i % 2 != 0:
                print(0)
                exit()"""
    for i in a:
        if i == 0 and x[i] == 1:
            print((0))
            exit()
        elif x[i] == 2:
            print((0))
            exit()
        else:
            x[i] += 1
    print((reduce(lambda x, y: x * y if y != 0 else x, x, 1) % (10**9 + 7)))

-    if n % 2 == 0: +    """if n % 2 == 0: -                print((0)) +                print(0) -                print((0)) -                exit() +                print(0) +                exit()"""