for t in range(int(input())): N=int(input()) F=list(map(int,input().split())) print(N-sum(F))