t=int(input()) for i in range(t): n=int(input()) f=sum(list(map(int,input().split()))) print((n-f+1)%(n+1))