There are N people, conveniently numbered 1 through N.
They were standing in a row yesterday, but now they are unsure of the order in which they were standing.
However, each person remembered the following fact: the absolute difference of the number of the people who were standing to the left of that person, and the number of the people who were standing to the right of that person.
According to their reports, the difference above for person i is A_i.
Based on these reports, find the number of the possible orders in which they were standing.
Since it can be extremely large, print the answer modulo 10^9+7.
Note that the reports may be incorrect and thus there may be no consistent order.
In such a case, print 0.

-----Constraints-----
 - 1≦N≦10^5
 - 0≦A_i≦N-1

-----Input-----
The input is given from Standard Input in the following format:
N
A_1 A_2 ... A_N

-----Output-----
Print the number of the possible orders in which they were standing, modulo 10^9+7.

-----Sample Input-----
5
2 4 4 0 2

-----Sample Output-----
4

There are four possible orders, as follows:
 - 2,1,4,5,3
 - 2,5,4,1,3
 - 3,1,4,5,2
 - 3,5,4,1,2
[{"code": "n = int(input())\na = [int(x) for x in input().split()]\na.sort()\nmod = 10 ** 9 + 7\n\ndef p(p):\n  ans = 1\n  for i in range(p):\n    ans *= 2\n    ans %= mod\n  return ans\n\nif n % 2 == 1:\n  res = True\n  for i in range(n):\n    if a[i] != ((i + 1) // 2) * 2:\n      res = False\n  if res:\n    print(p(n // 2))\n  else:\n    print(0)\n    \nelse:\n  res = True\n  for i in range(n):\n    if a[i] != (i // 2) * 2 + 1:\n      res = False\n  if res:\n    print(p(n // 2))\n  else:\n    print(0)", "passed": true, "time": 0.15, "memory": 14340.0, "status": "done"}, {"code": "N=int(input())\n*A,=sorted(map(int,input().split()))\n\ndef f(x):\n for i in range(x,N,2):\n  if A[i-1]!=i or A[i]!=i:\n    return 0\n return 1   \n    \na=1\nif N%2==0:a=f(1)\nelse:\n if A[0]!=0:a=0\n else:a=f(2)\nprint(2**(N//2)%(10**9+7)*a)", "passed": true, "time": 0.15, "memory": 14256.0, "status": "done"}, {"code": "import math\n\nN = 5\nARR = [2, 4, 4, 0, 2]\n\nN = 7\nARR = [6, 4, 0, 2, 4, 0, 2]\n#\n# N = 8\n# ARR = [7, 5, 1, 1, 7, 3, 5, 3]\n#\nN = int(input())\nARR = list(map(int, input().split()))\n\n\ndef calculate(n, arr):\n    if n % 2 == 0:\n        n = n // 2\n        start = 1\n        finalResult = pow(2, n, 1000000000 + 7)\n    else:\n        n = n // 2 + 1\n        start = 0\n        finalResult = pow(2, (n - 1), 1000000000 + 7)\n\n    result = {}\n    for i in range(n):\n        index = start + 2 * i\n        if index == 0:\n            result.__setitem__(0, 1)\n        else:\n            result.__setitem__(index, 2)\n\n    isOk = True\n    for i in range(len(arr)):\n        if result.get(arr[i]) == None:\n            isOk = False\n            break\n\n        if result.get(arr[i]) == 0:\n            isOk = False\n            break\n\n        result.__setitem__(arr[i], result.get(arr[i])-1)\n\n    if isOk == False:\n        print((0))\n        return\n\n    if sum(result.values()) == 0:\n        print(finalResult)\n    else:\n        print((0))\n\n\ncalculate(N, ARR)\n", "passed": true, "time": 0.2, "memory": 14112.0, "status": "done"}, {"code": "n = int(input())\na = list(map(int, input().split()))\na.sort()\nres = True\nif n % 2 != 0:\n  if a[0] != 0:\n    res = False\n    print(0)\n  a = a[1:]\nfor i in range(0, len(a), 2):\n  if a[i] != a[i+1]:\n    print(0)\n    res = False\n    break\n\np = 10**9 + 7\nif res:\n  print(pow(2, n//2, p))", "passed": true, "time": 0.15, "memory": 14256.0, "status": "done"}, {"code": "n = int(input())\na = sorted(list(map(int, input().split())))\nans = 1\n\nif n%2 == 0:\n    for i in range(0, n, 2):\n        if a[i] != i + 1 or a[i + 1] != i + 1:\n            print(0)\n            return\nelse:\n    if a[0] != 0:\n        print(0)\n        return\n    for i in range(1, n, 2):\n        if a[i] != i + 1 or a[i + 1] != i + 1:\n            print(0)\n            return\n\nfor i in range(n//2):\n    ans = ans*2%(10**9 + 7)\n\nprint(ans)", "passed": true, "time": 0.23, "memory": 14184.0, "status": "done"}, {"code": "n = int(input())\na = sorted(list(map(int, input().split())))\n\nif n%2 == 0: # \u4eba\u6570\u304c\u5076\u6570\u306e\u5834\u5408\u306b\u4e0d\u6574\u5408\u304c\u3042\u308b\u304b\u78ba\u8a8d\n  for i in range(0,n,2):\n    if a[i] != i+1 or a[i+1] != i+1:\n      print(0)\n      return\nelse: # \u4eba\u6570\u304c\u5947\u6570\u306e\u5834\u5408\u306b\u4e0d\u6574\u5408\u304c\u3042\u308b\u304b\u78ba\u8a8d\n  if a[0] != 0: # \u5dee\u5206\u304c0\u5b58\u5728\u3057\u3066\u3044\u308b\u3053\u3068\u3092\u78ba\u8a8d\n    print(0)\n    return\n  else:\n    for i in range(1,n,2):\n      if a[i] != i + 1 or a[i+1] != i + 1:\n        print(0)\n        return\n        \nans = 1        \nfor i in range(n//2):\n  ans = ans*2%(10**9+7)\nprint(ans)", "passed": true, "time": 0.14, "memory": 14340.0, "status": "done"}, {"code": "n = int(input())\na = sorted(list(map(int, input().split())))\nif n % 2 == 0:\n    b,s = [1,1],3\nelse:\n    b,s = [0],2\nfor i in range(s,n,2):\n    b += [i,i]\nif a == b:\n    print(pow(2,n//2,1000000007))\nelse:\n    print(0)", "passed": true, "time": 0.14, "memory": 14228.0, "status": "done"}, {"code": "N = int(input())\nN_List = sorted(list(map(int,input().split())))\nflg = 0\nans = 1\nif N % 2 == 1:\n    if N_List[0] != 0:\n        flg = 1\n    else:\n        for i in range(2,N,2):\n            if i*2 != sum(N_List[i-1:i+1]):\n                flg = 1\n                break\n            else:\n                ans = (ans * 2) % ((10**9) +7)\n        \n\nelse:\n    for i in range(1,N,2):\n        if i*2 != sum(N_List[i-1:i+1]):\n            flg = 1\n            break\n        else:\n            ans = (ans * 2) % ((10**9) +7)\n\nif flg == 0:\n    print(ans)\nelse:\n    print((0))\n\n                \n", "passed": true, "time": 0.23, "memory": 14196.0, "status": "done"}, {"code": "N = int(input())\nA = [int(x) for x in input().split()]\n\ncnt = {}\nif N & 1:\n    bit = 1\nelse:\n    bit = 0\n\nfor a in A:\n    if a & bit:\n        ans = 0\n        break\n    if a in cnt:\n        cnt[a] += 1\n    else:\n        cnt[a] = 1\n\nfor key in list(cnt.keys()):\n    if key == 0 and cnt[key] != 1:\n        ans = 0\n        break\n    if key != 0 and cnt[key] != 2:\n        ans = 0\n        break\nelse:\n    ans = 2**(N//2) %1000000007\nprint(ans)\n", "passed": true, "time": 0.14, "memory": 14260.0, "status": "done"}, {"code": "n=int(input())\nfrom collections import Counter as co\nc=co(map(int,input().split()))\nans=pow(2,n//2,10**9+7)\nif n%2 :\n    if 0 not in c or c[0]>1:ans=0\n    for i in range(1,n):\n        if i%2==0 :\n            if i not in c or c[i]!=2:ans=0;break\n        else:\n            if i in c:ans=0;break\nelse:\n    if 0 in c:ans=0\n    for  i in range(1,n):\n        if i%2:\n            if i not in c or c[i]!=2:ans=0;break\n        else:\n            if i in c:ans=0;break\nprint(ans)", "passed": true, "time": 1.63, "memory": 14368.0, "status": "done"}, {"code": "n = int(input())\na = list(map(int, input().split()))\nl = [0] * n\nfor x in a:\n    l[x] += 1\nfor i in range(n):\n    if l[i] > 2:\n        print(0)\n        return\n    if l[i] > 0 and (i + n) % 2 == 0: \n        print(0)\n        return\nif n % 2 == 1 and l[0] > 1:\n    print(0)\n    return\nprint(pow(2, n // 2, 10 ** 9 + 7))", "passed": true, "time": 0.23, "memory": 14316.0, "status": "done"}, {"code": "n = int(input())\na_list = sorted([int(x) for x in input().split()], reverse=True)\nm = n\nif m % 2 == 1:\n    a_list.append(0)\n    m += 1\nfor i in range(0, m, 2):\n    if not (a_list[i] == a_list[i + 1] == n - (i + 1)):\n        print(0)\n        return\nprint(2 ** (n // 2) % (10 ** 9 + 7))", "passed": true, "time": 0.22, "memory": 14308.0, "status": "done"}, {"code": "n = int(input())\na = list(map(int, input().split()))\nmod = 10 ** 9 + 7\nnum_map = [0] * ((n + 2 - 1) // 2)\nfor i in range(n):\n    num_map[a[i] // 2] += 1\n\nres = 2 - n % 2\nif num_map[0] != 2 - n % 2:\n    print((0))\nelse:\n    for i in range(1, (n + 2 - 1) // 2):\n        if num_map[i] != 2:\n            print((0))\n            break\n        else:\n            res = res * 2 % mod\n    else:\n        print(res)\n", "passed": true, "time": 0.22, "memory": 14068.0, "status": "done"}, {"code": "mod = 10**9+7\nn = int(input())\na = list(map(int,input().split()))\nc_dic = dict()\nif n%2 == 0:\n  for num in a:\n    if num%2 == 0 or n < num:\n      print(0)\n      return\n    if num in c_dic:\n      c_dic[num] += 1\n      if c_dic[num] > 2:\n        print(0)\n        return\n    else:\n      c_dic[num] = 1\n  print(pow(2,n//2,mod))\nelse:\n  for num in a:\n    if num%2 == 1 or n < num:\n      print(0)\n      return\n    if num in c_dic:\n      c_dic[num] += 1\n      if c_dic[num] > 2:\n        print(0)\n        return\n    else:\n      c_dic[num] = 1\n  if c_dic[0] != 1:\n    print(0)\n    return\n  print(pow(2,n//2,mod))", "passed": true, "time": 0.23, "memory": 14316.0, "status": "done"}, {"code": "import sys\nfrom collections import Counter\n\nn = int(input())\na = list(map(int, input().split()))\na.sort()\n\nl = []\n\nfor i in range(n):\n    li = abs(i - (n-1-i))\n    l.append(li)\n    \nl.sort()\n\n\nfor ai, li in zip(l,a):\n    if ai != li:\n        print((0))\n        return\n\nd = Counter(l)\nmod = 10 ** 9 + 7\nans = 1\n\nfor li in d:\n    for j in range(1,d[li]+1):\n        ans *= j\n        ans %= mod\n\nprint(ans)\n", "passed": true, "time": 0.14, "memory": 14296.0, "status": "done"}, {"code": "n=int(input())\na=[int(i) for i in input().split()]\n\ndef somosomo(a):\n    ans=[]\n    if n%2==1:\n        ans.append(0)\n        for i in range(1,n//2+1):\n            ans.append(i*2)\n            ans.append(i*2)\n        b=sorted(a)\n        if b==ans:\n            return True\n        return False\n    else:\n        for i in range(1,n//2+1):\n            ans.append(i*2-1)\n            ans.append(i*2-1)\n        b=sorted(a)\n        if b==ans:\n            return True\n        return False\n\ndef two_ride(n):\n    ans=1\n    for i in range(n):\n        ans*=2\n        ans%=10**9+7\n    return ans\n\nif somosomo(a):\n    print(two_ride(n//2))\nelse:\n    print(0)", "passed": true, "time": 0.14, "memory": 14116.0, "status": "done"}, {"code": "n=int(input())\na=list(map(int,input().split()))\nl=[0]*n\nfor i in range(n):\n    l[a[i]]+=1\n#print(l)\nif n%2==1:\n    if l[0]!=1:\n        print(0)\n        return\nans=1\nfor i in range(n):\n    if n%2==0:\n        if i%2==0:\n            if l[i]!=0:\n                print(0)\n                return\n    else:\n        if i%2==1:\n            if l[i]!=0:\n                print(0)\n                return\n    \n    if l[i]==2:\n        ans*=2\n    elif l[i]>2:\n        print(0)\n        return\n    ans%=(10**9 +7)\nprint(ans)", "passed": true, "time": 0.15, "memory": 14380.0, "status": "done"}, {"code": "N = int(input())\ncount = [0]*(N+1)\nmodz = 10**9 + 7\n\ndef junretsu(a):\n    if a <= 0: return 1\n    if (a & 0x01) == 1:\n        return 2*junretsu(a-1) % modz\n    else:\n        rr = junretsu(a>>1)\n        return rr*rr % modz\n\npos = list(map(int, input().split()))\nfor i in range(N):\n    count[pos[i]] += 1\n\ndiff = [0]*(N+1)\nfor i in range(1, N+1):\n    d = abs((N - i) - (i-1))\n    diff[d] += 1\n\ninvalid = False\ntotal = 1\nfor i in range(N):\n    if count[i] != diff[i]:\n        invalid = True\n        break\n\nif invalid:\n    print((0))\nelse:\n    print((junretsu(int(N/2))))\n", "passed": true, "time": 0.14, "memory": 14080.0, "status": "done"}, {"code": "num = int(input())\nt = [int(n) for n in input().split()]\nt = sorted(t)\n\nvalid = True\n\nif num % 2 == 1: # odd\n  check = list(range(0,num+1,2))[1:]\n  \n  valid1 = t[0] == 0\n  valid2 = check == t[2::2] # even, skip first\n  valid3 = check == t[1::2] # odd\n  valid = valid1 and valid2 and valid3\n  \n  if not valid:\n    print((0))\n  else:\n    ans = 2**((num-1)//2) % (10**9 + 7)\n    print(ans)\n  \nelse: # even \n  check = list(range(1,num,2))\n  \n  valid1 = True\n  valid2 = check == t[::2] # even\n  valid3 = check == t[1::2] # odd\n  valid = valid1 and valid2 and valid3\n  \n  if not valid:\n    print((0))\n  else:\n    ans = 2**((num)//2) % (10**9 + 7)\n    print(ans)\n\n\n  \n", "passed": true, "time": 0.14, "memory": 14376.0, "status": "done"}, {"code": "N = int(input())\nA = list(map(int,input().split()))\n   \nA.sort()\n\ncheck=[0]*N\n\nfor idx in range(N%2,N,2):\n    check[idx]=idx+1\n    check[idx+1]=idx+1\n\nans=0\n\nif check == A:\n    if N % 2 == 0:\n        ans=(2**(N//2))%(10**9+7)\n    elif N % 2 != 0:\n        ans=(2**((N-1)//2))%(10**9+7)\n    \nprint(ans)\n", "passed": true, "time": 0.14, "memory": 14212.0, "status": "done"}, {"code": "n=int(input())\nmod=10**9+7\nA=list(map(int,input().split()))\n\nfrom collections import Counter\nC=Counter(A)\nif n%2==0:\n    for i in range(1,n,2):\n        if C.get(i) != 2:\n            print(0);return\nelse:\n    if C.get(0) !=1:\n        print(0);return\n    for i in range(2,n,2):\n        if C.get(i)!=2:\n            print(0);return\n\nn//=2\nprint(pow(2,n,mod))", "passed": true, "time": 0.14, "memory": 14284.0, "status": "done"}, {"code": "n = int(input())\na = sorted(list(map(int, input().split())))\n\nif len(a)%2==1:\n    tmp = [0]\n    for i in range((len(a)-1)//2):\n        tmp.append((i+1)*2)\n        tmp.append((i+1)*2)\n    if a == tmp:\n        ans = (2**((len(a)-1)//2))%(10**9+7)\n    else:\n        ans = 0\nelse:\n    tmp = []\n    for i in range(len(a)//2):\n        tmp.append(2*i+1)\n        tmp.append(2*i+1)\n    if a == tmp:\n        ans = (2**(len(a)//2))%(10**9+7)\n    else:\n        ans = 0\nprint(ans)", "passed": true, "time": 0.15, "memory": 14296.0, "status": "done"}, {"code": "N = int(input())\nAs = list(map(int, input().split()))\n# \u7d76\u5bfe\u5024\u306e\u5dee\u306f\u3001\n# \u5947\u6570\u306e\u5834\u5408\u306fN+1\u304b\u30892\u305a\u3064\u6e1b\u3089\u3057\u3066\u884c\u3063\u305f\u5206\u3057\u304b\u306a\u3044\u3002(N+1)/2\n# \u5076\u6570\u306e\u5834\u5408\u306fN\u304b\u30892\u305a\u3064\u6e1b\u3089\u3057\u3066\u884c\u3063\u305f\u5206\u3057\u304b\u306a\u3044\u3002N/2\nnums = {}\nexists = True\nif N % 2 == 0:\n    for A in As:\n        if A in nums:\n            nums[A] += 1\n        else:\n            nums[A] = 1\n    for key, value in list(nums.items()):\n        if key == 0:\n            exists = False\n        if value != 2:\n            exists = False\n\nelse:\n    for A in As:\n        if A in nums:\n            nums[A] += 1\n        else:\n            nums[A] = 1\n    for key, value in list(nums.items()):\n        if key == 0:\n            if value != 1:\n                exists = False\n        else:\n            if value != 2:\n                exists = False\nif not exists:\n    print((0))\nelse:\n    ans = 1\n    if N % 2 == 0:\n        for i in range(int(N / 2)):\n            ans = ans * 2\n            ans %= 10**9 + 7\n    else:\n        for i in range(int((N - 1) / 2)):\n            ans = ans * 2\n            ans %= 10**9 + 7\n            # \u7d76\u5bfe\u5024\u306e\u5dee\u306f0\u306e\u6642\u306f1\u4eba\u3060\u3051\u3002\u305d\u306e\u307b\u304b\u306f2\u4eba\u3060\u3051\u3002\u3053\u308c\u304c\u6e80\u305f\u305b\u308b\u306a\u3089\n            # (\u5076\u6570)2**(N+1/2)\n            # (\u5947\u6570)2**(N/2)\n    print(ans)\n", "passed": true, "time": 0.14, "memory": 14296.0, "status": "done"}, {"code": "from collections import Counter\n\n\ndef mod_pow(a, n, mod):\n    \"\"\"\n    \u4e8c\u5206\u7d2f\u4e57\u6cd5\u306b\u3088\u308b a^n (mod m)\u306e\u5b9f\u88c5\n    :param a: \u7d2f\u4e57\u306e\u5e95\n    :param n: \u7d2f\u4e57\u306e\u6307\u6570\n    :param mod: \u6cd5\n    :return: a^n (mod m)\n    \"\"\"\n\n    result = 1\n    a_n = a\n    while n > 0:\n        if n & 1:\n            result = result * a_n % mod\n        a_n = a_n * a_n % mod\n        n >>= 1\n    return result\n\n\nN = int(input())\nA = Counter(tuple(map(int, input().split(' '))))\nMOD = 10 ** 9 + 7\n\nif A[0] > 1:\n    print((0))\nelif sum([key for key, value in list(A.items()) if value == 1]) != 0:\n    print((0))\nelse:\n    print((mod_pow(2, N // 2, MOD)))\n", "passed": true, "time": 0.22, "memory": 14116.0, "status": "done"}, {"code": "N = int(input())\nA = list(map(int, input().split()))\nmod = 10 ** 9 + 7\n\nA = sorted(A)\nans = 1\nif N % 2 == 0:#[1,1,3,3,5,5,...]\n  for i in range(N):\n    xx = int(i / 2)\n    if A[i] != 2 * xx + 1:\n      ans = 0\n    else:\n      if i % 2 == 1:\n        ans *= 2\n        ans %= mod\nelse:#[0, 2, 2, 4, 4 ...]\n  for i in range(N):\n    xx = int((i + 1)/2)\n    if A[i] != 2 * xx:\n      ans = 0\n    else:\n      if (i % 2 == 0) and (i != 0):\n        ans *= 2\n        ans %= mod\n      \n      \n  \n  \nprint(ans)\n\n", "passed": true, "time": 0.14, "memory": 14132.0, "status": "done"}, {"code": "n = int(input())\na = list(map(int, input().split()))\na.sort()\nres = True\nanse = list(i for i in range(1, n, 2))\nanso = list(i for i in range(2, n, 2))\nif n % 2 != 0:\n  if a[0] != 0:\n    res = False\n    print(0)\n  a = a[1:]\n  for i in range(0, len(a), 2):\n    if a[i] != anso[i//2] or a[i+1] != anso[i//2]:\n        print(0)\n        res = False\n        break\n\n\nif n % 2 == 0:\n    for i in range(0, len(a), 2):\n        if a[i] != anse[i//2] or a[i+1] != anse[i//2]:\n            print(0)\n            res = False\n            break\n\np = 10**9 + 7\nif res:\n  print(pow(2, n//2, p))", "passed": true, "time": 0.22, "memory": 14160.0, "status": "done"}, {"code": "n=int(input())\nl=list(map(int,input().split()))\nmod=10**9+7\nif n%2==0:\n    d={i:2 for i in range(1,n,2)}\nelse:\n    d={i:2 for i in range(0,n,2)}\n    d[0]=1\nfor a in l:\n    if a in d:\n        d[a]-=1\n    else:\n        print((0))\n        return\nfor i in list(d.values()):\n    if i!=0:\n        print((0))\n        return\nprint(((2**(n//2))%mod))\n", "passed": true, "time": 0.23, "memory": 14332.0, "status": "done"}, {"code": "from collections import Counter\n\nn = int(input())\nA = list(map(int, input().split()))\ncnt_A = Counter(A)\n\nif not all([v == 2 for k, v in cnt_A.items() if k != 0]):\n    print(0)\nelse:\n    print(pow(2, n // 2, 10**9 + 7))", "passed": true, "time": 0.77, "memory": 14144.0, "status": "done"}, {"code": "N = int(input())\nA = list(map(int, input().split()))\n\nans = 0\nA_test = sorted(list(set(A)))\n\nif N % 2 == 1:\n    judge = [i for i in range(0,N,2)]\n    if (A_test == judge) and (A.count(0) == 1):\n        ans = 2**(N//2)\nelse:\n    judge = [i for i in range(1,N,2)]\n    if A_test == judge:\n        ans = 2**(N//2)\n\nans = ans % (10**9 + 7)\nprint(ans)\n", "passed": true, "time": 0.14, "memory": 14084.0, "status": "done"}, {"code": "import sys\nfrom collections import Counter\nN = int(input())\nA = list(map(int, input().split()))\nMOD = 10 ** 9 + 7\n\nC = Counter(A)\nC = sorted(C.items(), key=lambda x: x[0])\nif N % 2 == 0:\n    s = 1\n    for k, v in C:\n        if k != s or v != 2:\n            print(0)\n            return\n        s += 2\n    print(pow(2, (N // 2), MOD))\nelse:\n    s = 0\n    for k, v in C:\n        if k == 0:\n            if k != 0 or v != 1:\n                print(0)\n                return\n            s += 2\n            continue\n        if k != s or v != 2:\n            print(0)\n            return\n        s += 2\n    print(pow(2, (N - 1) // 2, MOD))", "passed": true, "time": 0.15, "memory": 14240.0, "status": "done"}, {"code": "from collections import Counter\nn=int(input())\na=sorted(list(map(int,input().split())))\na_count=Counter(a)\nif n%2==1:\n    ans=1\n    for i in a_count:\n        if i%2!=0:\n            print(0)\n            break\n        else:\n            if i==0:\n                if a_count[i]!=1:\n                    print(0)\n                    break\n            \n            else:\n                if a_count[i]==2:\n                     ans=(ans*2)%(10**9+7)\n                else:\n                    print(0)\n                    break\n    else:\n      print(ans)\nelse:\n    ans=1\n    for j in a_count:\n        if j%2!=1:\n            print(0)\n            break\n        else:\n            if a_count[j]==2:\n                ans=(ans*2)%(10**9+7)\n           \n            else:\n                print(0)\n                break\n    else:\n      print(ans)", "passed": true, "time": 0.14, "memory": 14268.0, "status": "done"}, {"code": "n = int(input())\na = list(map(int, input().split()))\nflg = 0\n\na.sort()\nif n % 2 == 0:\n  if a[0] == 1 and a[1] == 1:\n    for i in range(2, n, 2):\n      if a[i] == a[i + 1] and a[i - 1] + 2 == a[i]:\n        continue\n      else:\n        flg = 1\n        break\n  else:\n    flg = 1\nelse:\n  if a[0] == 0:\n    for i in range(1, n, 2):\n      if a[i] == a[i + 1] and a[i - 1] + 2 == a[i]:\n        continue\n      else:\n        flg = 1\n        break\n  else:\n    flg = 1\n\nif flg == 1:\n  print(0)\nelse:\n  print((2 ** (n // 2)) % (10 ** 9 + 7))", "passed": true, "time": 0.22, "memory": 14388.0, "status": "done"}, {"code": "n=int(input())\nl=list(map(int,input().split()))\nmod=10**9+7\nif n%2==0:\n    d={i:2 for i in range(1,n,2)}\nelse:\n    d={i:2 for i in range(0,n,2)}\n    d[0]=1\nfor a in l:\n    if a in d:\n        d[a]-=1\n    else:\n        print(0)\n        return\nfor i in d.values():\n    if i!=0:\n        print(0)\n        return\nprint((2**(n//2))%mod)", "passed": true, "time": 0.22, "memory": 14332.0, "status": "done"}, {"code": "def main():\n  N = int(input())\n  A = [int(a) for a in input().split(\" \")]\n  A.sort()\n \n  if N % 2 == 1 and A.count(0) != 1:\n    print(0)\n    return 0\n  elif N % 2 == 0 and A.count(0) > 0:\n    print(0)\n    return 0\n  \n  if N % 2 == 1:\n    A.pop(0)\n  \n  cnt = 0\n  while len(A) > 0:\n    if A[0] != A[1] or (len(A) > 2 and A[0] == A[1] and A[1] == A[2]):\n      print(0)\n      return 0\n    elif A[0] == A[1] == 2 * cnt + (N % 2) + 1:\n      cnt += 1\n      A.pop(0)\n      A.pop(0)\n    else:\n      print(0)\n      return 0\n \n  ans = 1\n  for p in range(cnt):\n    ans = (ans * 2) % 1000000007\n  print(ans)\n\nmain()", "passed": true, "time": 0.22, "memory": 14304.0, "status": "done"}, {"code": "n = int(input())\na = sorted(list(map(int, input().split())))\n\nif n == 1:\n  print(1)\n  return\nelif n%2 == 0:\n  for i in range(0,n-2,2):\n    if a[i] != a[i+1] or a[i] == a[i+2]:\n      print(0)\n      return\n  if a[-2] != a[-1]:\n    print(0)\n    return\nelse:\n  if a[0] != 0 or a[1] == 0:\n    print(0)\n    return\n  for i in range(1,n-2,2):\n    if a[i] != a[i+1] or a[i] == a[i+2]:\n      print(0)\n      return\n  if a[-2] != a[-1]:\n    print(0)\n    return\n\nmod = 10**9+7\nif n%2 == 0: print(2**(n//2)%mod)\nelse: print(2**((n-1)//2)%mod)", "passed": true, "time": 0.21, "memory": 14228.0, "status": "done"}, {"code": "N = int(input())\nA = list(map(int, input().split()))\nmod = pow(10,9)+7\nA.sort()\n\nif N%2 == 0:\n    for i in range(N//2):\n        if A[2*i] != A[2*i+1] or A[2*i] != 2*i+1:\n            print((0))\n            return\n    ans = pow(2,N//2)\n    print((ans%mod))\nelse:\n    if A[0] != 0:\n        print((0))\n        return\n    for i in range(N//2):\n        if A[2*i+1] != A[2*(i+1)] or A[2*i+1] != 2*(i+1):\n            print((0))\n            return\n    ans = pow(2,N//2)\n    print((ans%mod))\n", "passed": true, "time": 0.22, "memory": 14252.0, "status": "done"}, {"code": "N=int(input())\n*A,=sorted(map(int,input().split()))\n \na=True\nif N%2==0:\n for i in range(1,N,2):\n  if A[i-1]!=i or A[i]!=i:\n    a=False\n    break\nelse:\n if A[0]!=0:a=False\n else:\n    for i in range(2,N,2):\n     if A[i-1]!=i or A[i]!=i:\n        a=False\n        break\nprint(2**(N//2)%(10**9+7) if a else 0)", "passed": true, "time": 0.22, "memory": 14100.0, "status": "done"}, {"code": "from collections import Counter\n\nN = int(input())\nA = list(map(int, input().split()))\nMOD = int(1e9) + 7\n\n# \u5076\u6570\u306e\u5834\u5408\nif N % 2 == 0:\n    c = Counter(A)\n    if all(i == 2 for i in c.values()):\n        print(pow(2, N//2, MOD))\n    else:\n        print(0)\n# \u5947\u6570\u306e\u5834\u5408\nelse:\n    A.sort()\n    A = A[1:]\n    c = Counter(A)\n    if all(i == 2 for i in c.values()):\n        print(pow(2, N//2, MOD))\n    else:\n        print(0)", "passed": true, "time": 0.22, "memory": 14216.0, "status": "done"}, {"code": "N = int(input())\na = list(map(int, input().split()))\nSum = 1\nmod = 1000000007\n\na.sort()\ndata = []\nif N % 2 == 0:\n    for i in range(int(N / 2)):\n        data.append(1 + i * 2)\n        data.append(1 + i * 2)\nelse:\n    data.append(0)\n    for i in range(1, N // 2 + 1):\n        data.append(i * 2)\n        data.append(i * 2)\n\nif a == data:\n    for i in range(N // 2):\n        Sum *= 2\n        Sum %= mod\n    print(Sum)\nelse:\n    print((0))\n", "passed": true, "time": 0.22, "memory": 14220.0, "status": "done"}, {"code": "N=int(input())\nA=list(map(int,input().split()))\n\nA.sort()\ncheck=[0]*N\n\nfor idx in range(N%2,N,2):\n    check[idx]=idx+1\n    check[idx+1]=idx+1\n\nans=0\nmod=10**9+7\nif check==A:\n    if N%2==0:\n        ans=(2**(N//2))%mod\n    else:\n        ans=(2**((N-1)//2))%mod\nprint(ans)", "passed": true, "time": 0.24, "memory": 13980.0, "status": "done"}, {"code": "n = int(input())\na = list(map(int, input().split()))\n\nfrom collections import Counter\nc = Counter(a)\n\ncheck_ary = []\nif n&1:\n    check_ary.append(0)\n\nfor i in range(n//2):\n    for _ in range(2):\n        check_ary.append((i+1)*2 if n&1 else i*2+1)\n\nc2 = Counter(check_ary)\n\nif c != c2:\n    print(0)\n    return\n\nprint(pow(2, n//2, 10**9+7))", "passed": true, "time": 0.14, "memory": 14160.0, "status": "done"}, {"code": "import sys\nimport heapq, math\nfrom itertools import zip_longest, permutations, combinations, combinations_with_replacement\nfrom itertools import accumulate, dropwhile, takewhile, groupby\nfrom functools import lru_cache\nfrom copy import deepcopy\n\nN = int(input())\nA = list(map(int, input().split()))\n\nB = [0] * N\n\nfor a in A:\n    B[a] += 1\n\nok = True\n\nif N % 2 == 1:\n    ok = ok and B[0] == 1\n    for i in range(1, N):\n        ok = ok and B[i] == (2 if i % 2 == 0 else 0)\nelse:\n    for i in range(N):\n        ok = ok and B[i] == (0 if i % 2 == 0 else 2)\n\nans = 1\nMOD = int(1e9) + 7\nfor _ in range(N // 2):\n    ans *= 2\n    ans %= MOD\n\nprint((ans if ok else 0))\n", "passed": true, "time": 0.14, "memory": 14272.0, "status": "done"}, {"code": "n=int(input())\nA=list(map(int,input().split()))\nA.sort()\njudge=0\nif n%2==1:\n    for i in range(n):\n        if A[i]!=2*((i+1)//2):\n            judge+=1\n            break\nelse:\n    for i in range(n):\n        if A[i]!=2*(i//2)+1:\n            judge+=1\n            break\nif judge==1:\n    print(0)\nelse:\n    print((2**(n//2))%(10**9+7))", "passed": true, "time": 0.16, "memory": 14112.0, "status": "done"}, {"code": "from collections import Counter\nn = int(input())\na = list(map(int, input().split()))\nc = Counter(a)\nd = list(c.values())\nif (n % 2 == 1 and c[0] == 1 and d.count(2) == (n-1)//2) or (n % 2 == 0 and d.count(2) == n//2):\n    print(pow(2, n//2, 10**9+7))\nelse:\n    print(0)", "passed": true, "time": 0.24, "memory": 13956.0, "status": "done"}, {"code": "from collections import Counter\nn = int(input())\na = list(map(int, input().split()))\nc = Counter(a)\nd = list(c.values())\nif (n % 2 == 1 and c[0] == 1 and d.count(2) == (n-1)//2) or (n % 2 == 0 and d.count(2) == n//2):\n    print((2**(n//2)) % (10**9+7))\nelse:\n    print(0)", "passed": true, "time": 0.15, "memory": 14276.0, "status": "done"}, {"code": "N = int(input())\nK = [0 for i in range(N+1)]\nA = list(map(int,input().rstrip().split(\" \")))\nans = 1\nfor i in A:\n    K[i] += 1\nfor i in range(N):\n    if i != 0 and K[i] != 0 and K[i] != 2:\n        ans = 0\n        break\n    if K[i] == 2:\n        ans *= 2\n        ans %= 10 ** 9 + 7\nprint(ans)", "passed": true, "time": 0.15, "memory": 14104.0, "status": "done"}, {"code": "import collections\n\nn = int(input())\na = list(map(int, input().split()))\ncnt = collections.Counter(a)\nmod = 7 + 10**9\nif n % 2 == 0:\n    for i in range(1, 1 + n // 2):\n        if (i * 2 - 1) not in cnt.keys() or cnt[i * 2 - 1] != 2:\n            print(0)\n            return\n\nelse:\n    if 0 not in cnt.keys() or cnt[0] != 1:\n        print(0)\n        return\n    for i in range(1, 1 + n // 2):\n        if i * 2 not in cnt.keys() or cnt[i * 2] != 2:\n            print(0)\n            return\nprint(2 ** (n // 2) % mod)", "passed": true, "time": 0.14, "memory": 14240.0, "status": "done"}, {"code": "n = int(input())\na = list(map(int, input().split()))\n\n\na = sorted(a)\n\nnum = 0\njudge = 0\n\nif len(a)%2 == 1:\n    if a[0] == 0:\n        for i in range(1, n, 2):\n            if a[i] == i+1 and a[i+1] == i+1:\n                num += 1\n            else:\n                print(0)\n                judge = 1\n                break\n    else:\n        print(0)\n        judge=1\nelse:\n    for i in range(0, n, 2):\n            if a[i] == i+1 and a[i+1] == i+1:\n                num += 1\n            else:\n                print(0)\n                judge = 1\n                break\n        \nif judge == 0:\n    result = (2**num)%(10**9+7)\n    print(result)", "passed": true, "time": 0.16, "memory": 14364.0, "status": "done"}, {"code": "from collections import defaultdict\nN = int(input())\nA = list(map(int, input().split()))\n\nL = A[:]\nL = list(set(L))\n\nmod = 10 ** 9 + 7\n\nd = defaultdict(int)\nfor i in range(N):\n    d[A[i]] += 1\n\nif N % 2 == 1:\n    bfr = 0\n    for i in L:\n        if i - bfr != 2 and i != 0:\n            print((0))\n            return\n\n        if i == 0:\n            if d[i] != 1:\n                print((0))\n                return\n            else:\n                continue\n        if d[i] != 2:\n            print((0))\n            return\n        bfr = i\n\n    print(((2 ** (N // 2)) % mod))\nelse:\n    bfr = 1\n    for i in L:\n        if i - bfr != 2 and i != 1:\n            print((0))\n            return\n\n        if d[i] != 2:\n            print((0))\n            return\n        bfr = i\n\n    print(((2 ** (N // 2)) % mod))\n", "passed": true, "time": 0.14, "memory": 14156.0, "status": "done"}, {"code": "n = int(input())\na = list(map(int,input().split()))\nmod = 10**9+7\n\na.sort()\n\nif n%2 == 1: \n    if a[0] != 0:\n        print((0))\n        return\n    else:\n        a.remove(0)\n        tmp = 2\nelse:\n    tmp = 1\n\nfor i in range(n//2):\n    if tmp == a[0] and tmp == a[1]:\n        a.remove(tmp)\n        a.remove(tmp)\n    else:\n        print((0))\n        return\n    tmp += 2\n\nif len(a) == 0:\n    print(((2**(n//2))%mod))\nelse:\n    print((0))\n\n\n", "passed": true, "time": 0.14, "memory": 14168.0, "status": "done"}, {"code": "n = int(input())\na = list(map(int, input().split()))\nmod = 10 ** 9 + 7\nnum_map = [0] * ((n + 2 - 1) // 2)\nfor i in range(n):\n    num_map[a[i] // 2] += 1\n\nres = 1\nif n % 2 == 1:\n    if num_map[0] != 1:\n        print((0))\n    else:\n        for i in range(1, (n + 2 - 1) // 2):\n            if num_map[i] != 2:\n                print((0))\n                break\n            else:\n                res = res * 2 % mod\n        else:\n            print(res)\nelse:\n    for i in range((n + 2 - 1) // 2):\n        if num_map[i] != 2:\n            print((0))\n            break\n        else:\n            res = res * 2 % mod\n    else:\n        print(res)\n", "passed": true, "time": 0.14, "memory": 14340.0, "status": "done"}, {"code": "N=int(input())\nA=list(map(int,input().split()))\nmod = 10**9+7\n\nA=tuple(sorted(A))\n\nif N % 2 == 1:\n  nums=[0]\n  for i in range(2,N+1,2):\n    nums.append(i)\n    nums.append(i)\nelse:\n  nums=[]\n  for i in range(1,N+1,2):\n    nums.append(i)\n    nums.append(i)\n    \nnums = tuple(nums)\nif A != nums:\n  print(0)\n  return\n  \nprint(2**(N//2) % mod)", "passed": true, "time": 0.19, "memory": 14296.0, "status": "done"}, {"code": "N = int(input())\nA = list(map(int,input().split()))\nA.sort()\nmod = 10**9 + 7\nif N%2 == 0:\n    for i in range(N):\n        if A[i] != 1+(i//2)*2:\n            print(0)\n            break\n    else:\n        print(pow(2,N//2,mod))\nelse:\n    if A[0] == 0:\n        for i in range(1,N):\n            if A[i] != ((i+1)//2)*2:\n                print(0)\n                break\n        else:\n            print(pow(2,N//2,mod))", "passed": true, "time": 0.15, "memory": 14248.0, "status": "done"}, {"code": "n = int(input())\na = list(map(int,input().split()))\nmod = 10**9 + 7\n\nd = [0]*(n+1)\nfor x in a:\n    d[x] += 1\nans = 1\nif n%2 == 0:\n    sw = 1\n    for i,x in enumerate(d):\n        if i%2 != 0:\n            if x == 2:\n                ans *= 2\n                ans %= mod\n            else:\n                sw = 0\n                break\n        else:\n            if x != 0:\n                sw = 0\n                break\nelse:\n    sw = 1\n    for i,x in enumerate(d):\n        if i%2 == 0:\n            if i == 0:\n                if x != 1:\n                    sw = 0\n                    break\n            else:\n                if x == 2:\n                    ans *= 2\n                    ans %= mod\n                else:\n                    sw = 0\n                    break\n        else:\n            if x != 0:\n                sw = 0\n                break\nif sw == 0:\n    ans = 0\nprint(ans)\n", "passed": true, "time": 0.23, "memory": 14220.0, "status": "done"}, {"code": "N = int(input())\nA = sorted(list(map(int,input().split())))\n\nif N%2==0:\n  B = [1+2*(n//2) for n in range(N)]\nelse:\n  B = [2*(n//2) for n in range(1,1+N)]\n\nif A==B:\n  print(pow(2,N//2,10**9+7))\nelse:\n  print(0)", "passed": true, "time": 0.14, "memory": 14136.0, "status": "done"}, {"code": "import bisect, collections, copy, heapq, itertools, math, string, sys\ninput = lambda: sys.stdin.readline().rstrip() \nsys.setrecursionlimit(10**7)\nINF = float('inf')\nMOD = 10 ** 9 + 7\ndef I(): return int(input())\ndef F(): return float(input())\ndef SS(): return input()\ndef LI(): return [int(x) for x in input().split()]\ndef LI_(): return [int(x)-1 for x in input().split()]\ndef LF(): return [float(x) for x in input().split()]\ndef LSS(): return input().split()\n\ndef resolve():\n    N = I()\n    A = LI()\n\n    if N % 2 == 0:\n        if sorted(A) == [i // 2 * 2 + 1 for i in range(N)]:\n            print((pow(2, N // 2, MOD)))\n        else:\n            print((0))\n    else:\n        if sorted(A) == [(i // 2 + 1) * 2 for i in range(-1, N - 1)]:\n            print((pow(2, (N - 1) // 2, MOD)))\n        else:\n            print((0))\n\ndef __starting_point():\n    resolve()\n\n__starting_point()", "passed": true, "time": 0.15, "memory": 14292.0, "status": "done"}, {"code": "def PowerMod(N,P,Mod):\n    if N%Mod==0:\n        return 0\n    else:\n        PowM = 1\n        for TP in range(1,P+1):\n            PowM = (PowM*N)%Mod\n        return PowM\n\nfrom collections import Counter\nN = int(input())\nA = sorted(Counter([int(T) for T in input().split()]).most_common(),key=lambda X:X[0])\nPassFlag = True\nif N%2==1:\n    for TA in range(0,(N+1)//2):\n        if A[TA][0]!=(2*TA) or A[TA][1]!=(1+(A[TA][0]!=0)):\n            PassFlag = False\n            break\n    print([0,PowerMod(2,(N-1)//2,10**9+7)][PassFlag])\nelse:\n    for TA in range(0,N//2):\n        if A[TA][0]!=(2*TA+1) or A[TA][1]!=2:\n            PassFlag = False\n            break\n    print([0,PowerMod(2,N//2,10**9+7)][PassFlag])", "passed": true, "time": 0.18, "memory": 14352.0, "status": "done"}, {"code": "from collections import Counter\n\nn = int(input())\nc = Counter(list(map(int, input().split())))\n\nans = 0\nfor k, v in list(c.items()):\n    if k == 0:\n        if n%2==0 and v > 2:\n            print((0))\n            return\n        elif n%2==1 and v > 1:\n            print((0))\n            return\n    else:\n        ans += 1\n        if v > 2:\n            print((0))\n            return\n\nprint((pow(2, ans, 10**9+7)))\n", "passed": true, "time": 0.71, "memory": 14124.0, "status": "done"}, {"code": "from typing import Counter\n\n\nn = int(input())\nlis = list(map(int, input().split()))\nmod  =10**9+7\n\nans = 0\nif n % 2 == 0:\n    b = Counter(lis)\n    flag = 1\n    for i in list(b.values()):\n        if i == 2:\n            pass\n        else:\n            flag = 0\n            break\n    if flag:\n        ans = 2**(n//2)\n        print((ans % mod))\n    else:\n        print((0))\nelse:\n    lis = sorted(lis)\n    lis = lis[1:]\n    b = Counter(lis)\n    flag = 1\n    for i in list(b.values()):\n        if i == 2:\n            pass\n        else:\n            flag = 0\n            break\n    if flag:\n        ans = 2**(n//2)\n        print((ans % mod))\n    else:\n        print((0))\n", "passed": true, "time": 0.15, "memory": 15276.0, "status": "done"}, {"code": "n=int(input())\na=list(map(int,input().split()))\nflag=0\nA=a.sort()\nnum=[]\n\nif n%2==0:\n    for i in range(1,n,2):\n        num.append(i)\n        num.append(i)\n\nif n%2==1:\n    num=[0]\n    for i in range(2,n,2):\n        num.append(i)\n        num.append(i)\n\nif num==a:\n    print(2**(n//2)%(10**9+7))\n\nelse:\n    print(\"0\")", "passed": true, "time": 0.72, "memory": 14368.0, "status": "done"}, {"code": "N=int(input())\n*A,=sorted(map(int,input().split()))\n\nf=lambda:2**(N//2)%(10**9+7)\na=True\nif N%2==0:\n    for i in range(1,N,2):\n        if A[i-1]!=i or A[i]!=i:\n            # print(i,A[i-1],A[i])\n            a=False\n            break\nelse:\n    if A[0]!=0:\n            a=False\n    else:\n        for i in range(2,N,2):\n            if A[i-1]!=i or A[i]!=i:\n                # print(i,A[i-1],A[i])\n                a=False\n                break\nprint(f() if a else 0)", "passed": true, "time": 0.16, "memory": 14204.0, "status": "done"}, {"code": "n = int(input())\nA = list(map(int, input().split()))\n\nd = {}\nfor a in A:\n    d[a] = d.get(a, 0)+1\n\nzero_cnt = 0\ntwo = 0\nno = 0\nfor i in d:\n    if i==0:\n        zero_cnt+=1\n    elif d[i]==2:\n        two+=1\n    else:\n        no+=1\n\nif no!=0 or (n%2==0 and zero_cnt!=0) or (n%2==1 and zero_cnt!=1):\n    print((0))\nelse:\n    ans = 1\n    mod = 10**9+7\n    for i in range(two):\n        ans *= 2\n        ans %= mod\n    print((ans%mod))\n", "passed": true, "time": 0.52, "memory": 14088.0, "status": "done"}, {"code": "MOD = 10 ** 9 + 7\nnum = [0] * (10 ** 5 + 1)\nN = int(input())\nA = list(map(int,input().split()))\nfor i in range(len(A)):\n\tnum[A[i]] += 1\nif N % 2 == 1:\n\tfor i in range(0,N,2):\n\t\tcnt = num[i]\n\t\tif i == 0:\n\t\t\tif cnt != 1:\n\t\t\t\tprint(0)\n\t\t\t\treturn\n\t\telse:\n\t\t\tif cnt != 2:\n\t\t\t\tprint(0)\n\t\t\t\treturn\n\tprint(2 ** (N // 2) % MOD)\nelse:\n\tfor i in range(1,N,2):\n\t\tcnt = num[i]\n\t\tif cnt != 2:\n\t\t\tprint(0)\n\t\t\treturn\n\tprint(2 ** (N // 2) % MOD)", "passed": true, "time": 0.16, "memory": 14308.0, "status": "done"}, {"code": "N=int(input())\n*A,=sorted(map(int,input().split()))\n\ndef f(x):\n for i in range(x,N,2):\n  if A[i-1]!=i or A[i]!=i:\n    return False\n return True   \n    \na=True\nif N%2==0:a=f(1)\nelse:\n if A[0]!=0:a=False\n else:a=f(2)\nprint(2**(N//2)%(10**9+7) if a else 0)", "passed": true, "time": 0.14, "memory": 14112.0, "status": "done"}, {"code": "import sys\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nsys.setrecursionlimit(10 ** 9)\nINF = 1 << 60\nMOD = 1000000007\n\n\ndef main():\n    N, *A = list(map(int, read().split()))\n\n    A.sort()\n\n    ok = True\n    if len(A) % 2 == 0:\n        for i in range(N // 2):\n            if not A[2 * i] == A[2 * i + 1] == 2 * i + 1:\n                ok = False\n                break\n    else:\n        if A[0] != 0:\n            ok = False\n        else:\n            for i in range(N // 2):\n                if not A[2 * i + 1] == A[2 * i + 2] == 2 * i + 2:\n                    ok = False\n                    break\n\n    if ok:\n        ans = pow(2, N // 2, MOD)\n    else:\n        ans = 0\n\n    print(ans)\n\n    return\n\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.14, "memory": 14284.0, "status": "done"}, {"code": "N = int(input())\nA = list(map(int, input().split()))\n\nm = 1000000007\n\nA.sort()\nif N % 2 == 0:\n    B = list(range(1, N, 2)) * 2\nelse:\n    B = [0] + list(range(2, N, 2)) * 2\nB.sort()\n\nif A != B:\n    print((0))\nelse:\n    result = 1\n    for i in range(N // 2):\n        result *= 2\n        result %= m\n    print(result)\n", "passed": true, "time": 0.14, "memory": 14224.0, "status": "done"}, {"code": "N = int(input())\nA = [int(x) for x in input().split()]\n\nfrom collections import defaultdict as dd\nDict = dd(lambda:0)\nfor a in A:\n    Dict[a] += 1\n\nif N & 1: Dict[0] += 1\nf = (lambda:(lambda x:0 if x&1 else 2) if N&1 else (lambda x:2 if x&1 else 0))()\nPossible = {i:f(i) for i in range(N)}\nfor key,value in list(Dict.items()):\n    if value != Possible[key]:\n        print((0))\n        return\nelse:\n    print((2**(N//2)%1000000007))\n                \n\n", "passed": true, "time": 0.23, "memory": 14272.0, "status": "done"}, {"code": "import sys\n\n# n = 10 ** 5\n# \u30c7\u30fc\u30bf\u8aad\u307f\u8fbc\u307f\u95a2\u4fc2\nn = int(input())\n\na = list(map(int, input().split(' ')))\n\nrecord = {}\n\npossible = True\n\n# \u72b6\u6cc1\u304c\u5b9f\u73fe\u53ef\u80fd\u304b\u78ba\u8a8d\nfor e in a:\n    if(e in record.keys()):\n        record[e] += 1\n        if(record[e] == 2):\n            if(e == 0):\n                possible = False\n                break\n        if(record[e] == 3):\n            possible = False\n            break\n    else:\n        record[e] = 1\n\nif(possible == False):\n    print(0)\n    return\n\nmultiCount = int(n / 2)\n\nprint(2 ** multiCount % (10 ** 9 + 7))", "passed": true, "time": 0.14, "memory": 14220.0, "status": "done"}, {"code": "import collections\nN = int(input())\nA = list(map(int,input().split()))\nans = 1\nif 0 in A:\n    A.remove(0)\nAcounter = collections.Counter(A)\nfor i in Acounter.values():\n    if i == 2:\n        continue\n    else:\n        ans = 0\n        break\nif ans == 0:\n    pass\nif ans != 0:\n    for i in range(N//2):\n        ans = (ans * 2) % (10**9 + 7)\nprint(ans)", "passed": true, "time": 0.23, "memory": 14156.0, "status": "done"}, {"code": "import sys\nsys.setrecursionlimit(10 ** 7)\ndef input() : return sys.stdin.readline().strip()\ndef INT()   : return int(input())\ndef MAP()   : return map(int,input().split())\ndef LIST()  : return list(MAP())\ndef NIJIGEN(H): return [list(input()) for i in range(H)]\nmod=1000000007\nN=INT()\nL=LIST()\nif N%2==0:\n  A=range(1,N,2)\n  B=range(1,N,2)\nelse:\n  A=range(0,N,2)\n  B=range(2,N,2)\nA,B=list(A),list(B)\nA=A+B\nif sorted(A)==sorted(L):\n  print(pow(2,N//2,mod))\nelse:\n  print(0)", "passed": true, "time": 0.15, "memory": 14100.0, "status": "done"}, {"code": "n=int(input())\na=list(map(int,input().split()))\n\nb=[0 for i in range(10**5+1)]\nfor i in a:\n  b[i]+=1\n\nif (n%2==0 and b[0]!=0) or (n%2==1 and b[0]!=1):\n  print(0)\n  return\n\nans=1\nmod=10**9+7\nfor i in b:\n  if i==2:\n    ans*=2\n    ans%=mod\n  if i>=3:\n    print(0)\n    return\n\nprint(ans)", "passed": true, "time": 0.16, "memory": 14364.0, "status": "done"}, {"code": "from collections import Counter\n\nn=int(input())\na=list(map(int,input().split()))\n\nc=Counter(a)\n\nif (n%2==0 and c[0]!=0) or (n%2==1 and c[0]!=1):\n  print(0)\n  return\n\nans=1\nmod=10**9+7\nfor i in c:\n  if c[i]==2:\n    ans*=2\n    ans%=mod\n  if c[i]>=3:\n    print(0)\n    return\n\nprint(ans)", "passed": true, "time": 0.14, "memory": 14208.0, "status": "done"}, {"code": "from collections import Counter\n\nN = int(input())\nabs_diffs = list(map(int, input().split()))\n\nif N % 2 == 0:\n    expected = [i // 2 * 2  + 1 for i in range(N)]\n    dims = N // 2\nelse:\n    expected = [(i + 1) // 2 * 2 for i in range(N)]\n    dims = (N - 1) // 2\n\nif sorted(abs_diffs) == expected:\n    print((2 ** dims % (10 ** 9 + 7)))\n\nelse:\n    print((0))\n", "passed": true, "time": 0.15, "memory": 14352.0, "status": "done"}, {"code": "n = int(input())\nA = sorted(map(int,input().split()))\n\nif n % 2 == 1:\n    ex = [0]\n    \n    for i in range(n//2):\n        a = 2 * (i+1)\n        ex += [a,a]\n        \nelse:\n    ex = []\n    a = 1\n    \n    for i in range(n//2):\n        ex += [a,a]\n        a += 2\n        \nans = 0\n\nif A == ex:\n    ans = 2 ** (n//2) % (10**9 + 7)\n    \nprint(ans)", "passed": true, "time": 0.14, "memory": 14340.0, "status": "done"}, {"code": "n = int(input())\na = list(map(int, input().split()))\nmod = 10 ** 9 + 7\nif n % 2 == 0:\n    b = [2 if i % 2 == 1 else 0 for i in range(n)]\nelse:\n    b = [2 if i % 2 == 0 else 0 for i in range(n)]\n    b[0] = 1\nc = [0 for i in range(n)]\nfor i in range(n):\n    c[a[i]] += 1\nif b != c:\n    print(0)\nelse:\n    ans = 1\n    for i in range(n // 2):\n        ans *= 2\n        ans %= mod\n    print(ans)", "passed": true, "time": 0.14, "memory": 14372.0, "status": "done"}, {"code": "N = int(input())\nA = sorted(list(map(int,input().split())))\n\nif N%2==0:\n  B = [2*(n//2)+1 for n in range(N)]\nelse:\n  B = [2*(n//2) for n in range(1,N+1)]\n\nif A==B:\n  print(pow(2,N//2,10**9+7))\nelse:\n  print(0)", "passed": true, "time": 0.15, "memory": 14312.0, "status": "done"}, {"code": "MOD = 10**9+7\n\ndef fast_pow(x, n, MOD):\n    res = 1\n    while n:\n        if n & 1:\n            res = res * x % MOD\n        x = x * x % MOD\n        n >>= 1\n    return res\n\n\nn = int(input())\na = list(map(int, input().split()))\n\nd = {}\nfor i in a:\n    if n % 2:\n        if i > 0 and i % 2:\n            print((0))\n            return\n    else:\n        if i > 0 and i % 2 == 0:\n            print((0))\n            return\n\n    if not i in d:\n        d[i] = 1\n    elif d[i] == 1:\n        d[i] += 1\n    else:\n        print((0))\n        return\n\nif n % 2:\n    if d[0] != 1:\n        print((0))\n        return\n    print((fast_pow(2, len(d)-1, MOD)))\nelse:\n    if 0 in d:\n        print((0))\n        return\n    print((fast_pow(2, len(d), MOD)))\n", "passed": true, "time": 0.15, "memory": 14380.0, "status": "done"}, {"code": "import math\nN = int(input())\nA = list(map(int, input().split()))\n\nflag = True\nif N%2 == 0:\n    if 0 in A or len(set(A)) != N//2:\n        flag = False\nelse:\n    if len([0 for a in A if a == 0]) != 1 or len(set(A)) != N//2 + 1:\n        flag = False\n\nif  flag:\n    print((2**((N//2))%(10**9+7)))\nelse:\n    print((0))\n", "passed": true, "time": 0.18, "memory": 14144.0, "status": "done"}, {"code": "N=int(input())\n*A,=sorted(map(int,input().split()))\n\ndef f(x):\n for i in range(x,N,2):\n  if A[i-1]!=i or A[i]!=i:\n    return 0\n return 1   \n    \na=1\nif N%2==0:a=f(1)\nelse: a=A[0]==0 and f(2)\nprint(2**(N//2)%(10**9+7)*a)", "passed": true, "time": 0.13, "memory": 14260.0, "status": "done"}, {"code": "n = int(input())\nA = tuple(map(int, input().split()))\nmod = 10**9+7\n\nniseven = (n%2 == 0)\n\ncd = dict()\nfor a in (A):\n    cd.setdefault(a, 0)\n    cd[a] += 1\n    if a == 0 and cd[a] > 1:\n        print((0))\n        break\n    if a > 0 and cd[a] > 2:\n        print((0))\n        break\n    if (a%2==0) == niseven:\n        print((0))\n        break\nelse:\n    print((pow(2, n//2, mod)))\n", "passed": true, "time": 0.14, "memory": 14088.0, "status": "done"}, {"code": "def main():\n  N=int(input())\n  A=list(map(int,input().split()))\n  mod=10**9+7\n  ans=1\n  A.sort()\n  if N%2==0:\n    for i in range(0,N,2):\n      if A[i]!=A[i+1] or A[i]!=i+1:\n        print(0)\n        return\n      ans=ans*2%mod\n    print(ans)\n  else:\n    if A[0]!=0:\n      print(0)\n      return\n    ans=1\n    for i in range(1,N,2):\n      if A[i]!=A[i+1] or A[i]!=i+1:\n        print(0)\n        return\n      ans=ans*2%mod\n    print(ans)\ndef __starting_point():\n  main()\n__starting_point()", "passed": true, "time": 0.14, "memory": 14380.0, "status": "done"}, {"code": "n = int(input())\na = list(map(int, input().split()))\n\n# \u77db\u76fe\u30c1\u30a7\u30c3\u30af\nfrom collections import Counter\nc = Counter(a)\n\ndef check():\n    if n&1:\n        if c[0]!=1:\n            return False\n        for i in range((n-1)//2):\n            if c[2*(i+1)] != 2:\n                return False\n    else:\n        for i in range(n//2):\n            if c[2*i+1] != 2:\n                return False\n    return True\n\nif not check():\n    print(0)\n    return\n\nprint(pow(2, n//2, 10**9+7))", "passed": true, "time": 0.15, "memory": 14320.0, "status": "done"}, {"code": "n = int(input())\na = list(map(int,input().split()))\ndic = {}\nfor i in range(n):\n    dic.setdefault(a[i],0)\n    dic[a[i]] += 1\nans = 1\nfor key,value in dic.items():\n    #\u5076\u6570\n    if n%2==0:\n        if n > key and key%2==1 and value==2:\n            ans *= 2\n        else:\n            ans = 0\n            break\n    #\u5947\u6570\n    else:\n        if n > key and key%2==0:\n            if key==0 and value==1:\n                ans *= 1\n            elif value==2:\n                ans *= 2\n            else:\n                ans = 0\n                break\n        else:\n            ans = 0\n            break\nprint(ans%(10**9+7))", "passed": true, "time": 0.14, "memory": 14324.0, "status": "done"}, {"code": "N=int(input())\nMOD=10**9+7\nA=[int(x) for x in input().split()]\nflag=1#\u305d\u306e\u4e26\u3073\u9806\u304c\u3042\u308a\u3048\u308b\u306a\u30891\u3001\u305d\u3046\u3067\u306a\u3044\u306a\u30890\nset1=set()\nset2=set()\nif N%2==1:\n    set1.add(0)\n    for j in range(2,N+1,2):\n        set1.add(j)\n        set2.add(j)\n    for i in range(N):\n        now=A[i]\n        if now in set1:\n            set1.remove(now)\n        elif now in set2:\n            set2.remove(now)\n        else:\n            flag=0\n            break\n    if len(set1)!=0 or len(set2)!=0:\n        flag=0\nelse:\n    for k in range(1,N+1,2):\n        set1.add(k)\n        set2.add(k)\n    for p in range(N):\n        now=A[p]\n        if now in set1:\n            set1.remove(now)\n        elif now in set2:\n            set2.remove(now)\n        else:\n            flag=0\n            break\n    if len(set1)!=0 or len(set2)!=0:\n        flag=0\nif flag==0:\n    print((0))\nelse:\n    ans=1\n    div2=N//2\n    for q in range(div2):\n        ans*=2\n        ans%=MOD\n    print(ans)\n", "passed": true, "time": 0.14, "memory": 14272.0, "status": "done"}, {"code": "N = int(input())\nA = list(map(int, input().split()))\n\nm = 1000000007\n\nA.sort()\nif N % 2 == 0:\n    B = list(range(1, N, 2)) * 2\nelse:\n    B = [0] + list(range(2, N, 2)) * 2\nB.sort()\n\nif A != B:\n    print((0))\nelse:\n    result = 1\n    for i in range(N // 2):\n        result *= 2\n        result %= m\n    print(result)\n", "passed": true, "time": 0.14, "memory": 14128.0, "status": "done"}, {"code": "n=int(input())\na=list(map(int,input().split()))\nif n%2==1:\n    x=[i for i in range(n)]\n    for i in range(n):\n        if i%2==1:\n            x[i]+=1\nelse:\n    x=[i for i in range(n)]\n    for i in range(n):\n        if i%2==0:\n            x[i]+=1\na.sort()\nif x==a:\n    print(pow(2,(n//2),10**9+7))\nelse:\n    print(0)", "passed": true, "time": 0.14, "memory": 14344.0, "status": "done"}, {"code": "import sys\nfrom collections import deque\np=10**9+7\n\ndef main(n,a):\n  h=n//2\n  g=n%2\n  a.sort()\n  c=[2*(x//2)+g+1 for x in range(n-g)]\n  if g==1:\n    c.insert(0,0)\n  if a!=c:\n      return 0\n  return 2**(h%(p-1)) % p\n\ndef __starting_point():\n  n=int(input())\n  a=list(map(int,sys.stdin.readline().strip().split()))\n  print((main(n,a)))\n\n__starting_point()", "passed": true, "time": 0.14, "memory": 14256.0, "status": "done"}, {"code": "N=int(input())\nS=list(map(int,input().split()))\nlenS=len(S)\nT=[]\nfor i in range(1,N+1):\n    T.append(abs(i-(N+1-i)))\n\nT.sort()\nS.sort()\n\n\n\nfor i in range(N):\n    if T[i]!=S[i]:\n        print((0))\n        return\n\n\nans=1\nnagasa=lenS//2\nfor i in range(nagasa):\n    \n    ans=(ans*2)%(10**9+7)\n\nprint(ans)\n\n\n", "passed": true, "time": 0.14, "memory": 14276.0, "status": "done"}, {"code": "n = int(input())\na = sorted(list(map(int, input().split())))\n\nif n%2 == 0: # \u4eba\u6570\u304c\u5076\u6570\u306e\u5834\u5408\u306b\u4e0d\u6574\u5408\u304c\u3042\u308b\u304b\u78ba\u8a8d\n  for i in range(0,n,2):\n    if a[i] != i+1 or a[i] != a[i+1]:\n      print(0)\n      return\nelse: # \u4eba\u6570\u304c\u5947\u6570\u306e\u5834\u5408\u306b\u4e0d\u6574\u5408\u304c\u3042\u308b\u304b\u78ba\u8a8d\n  if a[0] != 0: # \u5dee\u5206\u304c0\u5b58\u5728\u3057\u3066\u3044\u308b\u3053\u3068\u3092\u78ba\u8a8d\n    print(0)\n    return\n  else:\n    for i in range(1,n,2):\n      if a[i] != i+1 or a[i] != a[i+1]:\n        print(0)\n        return\n\nans = 1\nfor i in range(n//2):\n  ans = ans * 2 % (10**9+7) # \u7d44\u307f\u5408\u308f\u305b\u3068\u3057\u3066\u306f\u540c\u3058\u5dee\u5206\u306e\u5024\u3092\u5165\u308c\u66ff\u3048\u308b2\u629e\u306b\u306a\u308b\u306e\u3067\u3001\u7d50\u679c\u30922\u500d\u306b\u3059\u308b\nprint(ans)", "passed": true, "time": 0.14, "memory": 14108.0, "status": "done"}, {"code": "N=int(input())\n*A,=sorted(map(int,input().split()))\n\na=True\nif N%2==0:\n for i in range(1,N,2):\n  if A[i-1]!=i or A[i]!=i:\n    a=False\n    break\nelse:\n if A[0]!=0:a=False\n else:\n    for i in range(2,N,2):\n     if A[i-1]!=i or A[i]!=i:\n        a=False\n        break\nprint(2**(N//2)%(10**9+7) if a else 0)", "passed": true, "time": 0.14, "memory": 14332.0, "status": "done"}, {"code": "import math\nN = int(input())\nA = list(map(int, input().split()))\n\nflag = True\nif N%2 == 0:\n    if 0 in A or len(set(A)) != N//2:\n        flag = False\nelse:\n    if len([0 for a in A if a == 0]) != 1 or len(set(A)) != N//2 + 1:\n        flag = False\n\nif  flag:\n    print((2**(math.floor(N/2))%(10**9+7)))\nelse:\n    print((0))\n", "passed": true, "time": 0.14, "memory": 14140.0, "status": "done"}, {"code": "from collections import Counter\n\nn = int(input())\nA = list(map(int, input().split()))\ncnt_A = Counter(A)\n\nif all([v == 2 for k, v in cnt_A.items() if k != 0]):\n    print(pow(2, n // 2, 10**9 + 7))\nelse:\n    print(0)", "passed": true, "time": 0.14, "memory": 14256.0, "status": "done"}, {"code": "N=int(input())\nMOD=1000000007\nA=list(map(int,input().split()))\ncnt=[0 for i in range(N)]\nfor i in range(N):\n    cnt[A[i]]+=1\nif N%2==0:\n    for i in range(1,N,2):\n        if cnt[i]!=2:\n            print((0))\n            break\n    else:\n        print((2**(N//2)%MOD))\nelse:\n    if cnt[0]!=1:\n        print((0))\n    else:\n        for i in range(2,(N+1)//2,2):\n            if cnt[i]!=2:\n                print((0))\n                break\n        else:\n            print((2**((N-1)//2)%MOD))\n", "passed": true, "time": 0.14, "memory": 14192.0, "status": "done"}, {"code": "import collections\nimport sys\ninput = sys.stdin.readline\n\nN = int(input())\nA = list(map(int,input().split()))\nm = 1000000007\n\nflag0 = 1\ncount = 0\n#\u5076\u6570\u3060\u3063\u305f\u3089\nif N %2 ==0:\n    colA = collections.Counter(A)\n    for key,val in list(colA.items()):\n        if key%2 != 1 or val != 2:\n            flag0 = 0\n            break\n    for i in range(1,N,2):\n        if i not in list(colA.keys()):\n            flag = 0\n            break\n        else:\n            count +=1\n#\u5947\u6570\u3060\u3063\u305f\u3089\nelse:\n    A.append(0)\n    colA = collections.Counter(A)\n    for key,val in list(colA.items()):\n        if key%2 != 0 or val != 2:\n            flag0 = 0\n            break\n    for i in range(0,N,2):\n        if i not in list(colA.keys()):\n            flag = 0\n            break\n        else:\n            count +=1\n    count -=1\n\n\nprint((((2**count)%m)*flag0))\n    \n", "passed": true, "time": 0.14, "memory": 14116.0, "status": "done"}]