import sys input = sys.stdin.readline T=int(input()) for tests in range(T): N=int(input()) A=list(map(int,input().split())) print(N-sum(A))