import sys

n = int(eval(input()))

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



a.sort()

if n%2 == 0:

    for i in range(n-1):

        if i%2 == 0:

            if a[i] == a[i+1]:

                continue

            else:

                print((0))

                sys.exit()

        else:

            if a[i]+2 == a[i+1]:

                continue

            else:

                print((0))

                sys.exit()

    result = 2 ** (n//2)

    print((result % (10**9+7)))

else:

    if a[0] == 0:

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

            if i%2 == 1:

                if a[i] == a[i+1]:

                    continue

                else:

                    print((0))

                    sys.exit()

            else:

                if a[i]+2 == a[i+1]:

                    continue

                else:

                    print((0))

                    sys.exit()

        result = 2**((n-1)//2)

        print((result %(10**9+7)))

    else:

        print((0))

        sys.exit()
def main():

    import sys

    n = int(eval(input()))

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

    if n%2 == 1:

        a.append(0)

    a.sort()

    for i in range(n-1):

        if i%2 == 0:

            if a[i] == a[i+1]:

                continue

            else:

                print((0))

                sys.exit()

        else:

            if a[i]+2 == a[i+1]:

                continue

            else:

                print((0))

                sys.exit()

    result = 2 ** (n//2)

    print((result % (10**9+7)))

if __name__ == '__main__':

    main()
import sys

n = int(eval(input()))
a = list(map(int, input().split(" ")))
a.sort()
if n % 2 == 0:
    for i in range(n - 1):
        if i % 2 == 0:
            if a[i] == a[i + 1]:
                continue
            else:
                print((0))
                sys.exit()
        else:
            if a[i] + 2 == a[i + 1]:
                continue
            else:
                print((0))
                sys.exit()
    result = 2 ** (n // 2)
    print((result % (10**9 + 7)))
else:
    if a[0] == 0:
        for i in range(1, n - 1):
            if i % 2 == 1:
                if a[i] == a[i + 1]:
                    continue
                else:
                    print((0))
                    sys.exit()
            else:
                if a[i] + 2 == a[i + 1]:
                    continue
                else:
                    print((0))
                    sys.exit()
        result = 2 ** ((n - 1) // 2)
        print((result % (10**9 + 7)))
    else:
        print((0))
        sys.exit()

def main():
    import sys

    n = int(eval(input()))
    a = list(map(int, input().split(" ")))
    if n % 2 == 1:
        a.append(0)
    a.sort()
    for i in range(n - 1):
        if i % 2 == 0:
            if a[i] == a[i + 1]:
                continue
            else:
                print((0))
                sys.exit()
        else:
            if a[i] + 2 == a[i + 1]:
                continue
            else:
                print((0))
                sys.exit()
    result = 2 ** (n // 2)
    print((result % (10**9 + 7)))


if __name__ == "__main__":
    main()

-import sys +def main(): +    import sys -n = int(eval(input())) -a = list(map(int, input().split(" "))) -a.sort() -if n % 2 == 0: +    n = int(eval(input())) +    a = list(map(int, input().split(" "))) +    if n % 2 == 1: +        a.append(0) +    a.sort() -else: -    if a[0] == 0: -        for i in range(1, n - 1): -            if i % 2 == 1: -                if a[i] == a[i + 1]: -                    continue -                else: -                    print((0)) -                    sys.exit() -            else: -                if a[i] + 2 == a[i + 1]: -                    continue -                else: -                    print((0)) -                    sys.exit() -        result = 2 ** ((n - 1) // 2) -        print((result % (10**9 + 7))) -    else: -        print((0)) -        sys.exit() + + +if __name__ == "__main__": +    main()