#include<iostream>
#include<cmath>
#include<algorithm>
#include<string.h>
#include<vector>
#include<queue>
#include<stack>
#include<cstdio>
using namespace std;
#define inf 0x3f3f3f3f
int a[300000];
long long  modl(long long a, long long b, long long c)        //快速幂取余a^b%c
{
    long long res, t;
    res = 1 % c;
    t = a % c;
    while (b)
    {
        if (b & 1)
        {
            res = res * t % c;
        }
        t = t * t % c;
        b >>= 1;
    }
    return res;
}
int main()
{
        int  n;
        scanf("%d",&n);
         memset(a,0,sizeof(a));
        int b,flag1=1,flag2=1;
        long long sum=0;
        for(int i=0;i<n;i++)
        {
            scanf("%d",&b);
            a[b]++;
            if(a[b]>2) flag1=0;
            else if(a[0]>1) flag2=0;
            if(a[b]==1) sum++;
        }
        if(flag1==0||flag2==0||(n%2==0&&a[0]==1)) printf("0\n");
        else printf("%lld\n",modl(2,sum,1000000007)%1000000007);
    return 0;
}
