import sys, math input = lambda: sys.stdin.readline()[:-1] def MI(): return map(int, input().split()) inf = 10**18 tests, = MI() for __ in range(tests): n, = MI() f = list(MI()) res = n - sum(f) print(res-1 if res-1>=0 else res+1)