for _ in range(int(input())): N=int(input()) A=list(map(int,input().split())) print(0 if sum(A)!=0 else 1)