description: Luntik came out for a morning stroll and found an array a of length n. He calculated the sum s of the elements of the array (s= ∑_{i=1}^{n} a_i). Luntik calls a subsequence of the array a nearly full if the sum of the numbers in that subsequence is equal to s-1.
  
  Luntik really wants to know the number of nearly full subsequences of the array a. But he needs to come home so he asks you to solve that problem!
  
  A sequence x is a subsequence of a sequence y if x can be obtained from y by deletion of several (possibly, zero or all) elements.
  
  Input
  
  The first line contains a single integer t (1 ≤ t ≤ 1000) — the number of test cases. The next 2 ⋅ t lines contain descriptions of test cases. The description of each test case consists of two lines.
  
  The first line of each test case contains a single integer n (1 ≤ n ≤ 60) — the length of the array.
  
  The second line contains n integers a_1, a_2, …, a_n (0 ≤ a_i ≤ 10^9) — the elements of the array a.
  
  Output
  
  For each test case print the number of nearly full subsequences of the array.
  
  Example
  
  Input
  
  
  5
  5
  1 2 3 4 5
  2
  1000 1000
  2
  1 0
  5
  3 0 2 1 1
  5
  2 1 0 3 0
  
  
  Output
  
  
  1
  0
  2
  4
  4
  
  Note
  
  In the first test case, s=1+2+3+4+5=15, only (2,3,4,5) is a nearly full subsequence among all subsequences, the sum in it is equal to 2+3+4+5=14=15-1.
  
  In the second test case, there are no nearly full subsequences.
  
  In the third test case, s=1+0=1, the nearly full subsequences are (0) and () (the sum of an empty subsequence is 0).
solution: """
  
  Author : Preet Modh 
  
  """
  import sys,os
  from io import BytesIO, IOBase
  import bisect 
  
  
  
  
  def main():
      for _ in range(inp.single()):
          n = inp.single()
          a=inp.list()
          if a.count(1)==0:
              print(0)
              continue
          if a.count(0)==0:
              print(a.count(1))
              continue
          print((2**a.count(0))*(a.count(1)))       
          
          
  
          
  
          
  
  
          
  
  
          
  
  
  
  
  
  # Fast IO Region
  BUFSIZE = 8192
  class FastIO(IOBase):
      newlines = 0
      def __init__(self, file):
          self._fd = file.fileno()
          self.buffer = BytesIO()
          self.writable = "x" in file.mode or "r" not in file.mode
          self.write = self.buffer.write if self.writable else None
      def read(self):
          while True:
              b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
              if not b:
                  break
              ptr = self.buffer.tell()
              self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
          self.newlines = 0
          return self.buffer.read()
      def readline(self):
          while self.newlines == 0:
              b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
              self.newlines = b.count(b"\n") + (not b)
              ptr = self.buffer.tell()
              self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
          self.newlines -= 1
          return self.buffer.readline()
      def flush(self):
          if self.writable:
              os.write(self._fd, self.buffer.getvalue())
              self.buffer.truncate(0), self.buffer.seek(0)
  class IOWrapper(IOBase):
      def __init__(self, file):
          self.buffer = FastIO(file)
          self.flush = self.buffer.flush
          self.writable = self.buffer.writable
          self.write = lambda s: self.buffer.write(s.encode("ascii"))
          self.read = lambda: self.buffer.read().decode("ascii")
          self.readline = lambda: self.buffer.readline().decode("ascii")
  sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
  input = lambda: sys.stdin.readline().rstrip("\r\n")
  
  
  def memodict(f):
      """ Memoization decorator for a function taking a single argument. """
      class memodict(dict):
          def __missing__(self, key):
              ret = self[key] = f(key)
              return ret
  
      return memodict().__getitem__
  
  
  
  
  
  
  
  def gcd(x, y):
      """greatest common divisor of x and y"""
      while y:
          x, y = y, x % y
      return x
  
  
  
  
  
  
  def is_prime(n):
      """returns True if n is prime else False"""
      if n < 5 or n & 1 == 0 or n % 3 == 0:
          return 2 <= n <= 3
      s = ((n - 1) & (1 - n)).bit_length() - 1
      d = n >> s
      for a in [2, 325, 9375, 28178, 450775, 9780504, 1795265022]:
          p = pow(a, d, n)
          if p == 1 or p == n - 1 or a % n == 0:
              continue
          for _ in range(s):
              p = (p * p) % n
              if p == n - 1:
                  break
          else:
              return False
      return True
  
  def prime_sieve(n):
      """returns a sieve of primes >= 5 and < n"""
      flag = n % 6 == 2
      sieve = bytearray((n // 3 + flag >> 3) + 1)
      for i in range(1, int(n**0.5) // 3 + 1):
          if not (sieve[i >> 3] >> (i & 7)) & 1:
              k = (3 * i + 1) | 1
              for j in range(k * k // 3, n // 3 + flag, 2 * k):
                  sieve[j >> 3] |= 1 << (j & 7)
              for j in range(k * (k - 2 * (i & 1) + 4) // 3, n // 3 + flag, 2 * k):
                  sieve[j >> 3] |= 1 << (j & 7)
      return sieve
  
  
  def prime_list(n):
      """returns a list of primes <= n"""
      res = []
      if n > 1:
          res.append(2)
      if n > 2:
          res.append(3)
      if n > 4:
          sieve = prime_sieve(n + 1)
          res.extend(3 * i + 1 | 1 for i in range(1, (n + 1) // 3 + (n % 6 == 1)) if not (sieve[i >> 3] >> (i & 7)) & 1)
      return res
      
        
        
  class inputs:
      #To handle different inputs
      def single(self):
          return int(input())
      def mul(self):
          return map(int,input().split())
      def list(self):
          return  list(map(int,input().split()))
  
  inp=inputs()
  ########################################################
  
  if __name__ == "__main__":
      main()