Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.

Chef decided to teach some advanced recipes to junior chefs. On the very first day of their cooking sessions, to identify the cooking abilities of each junior chef, Chef instructed them to make their premier dishes. The junior chefs were very excited and they all went into the kitchen to cook their dishes.

Chef has a limited number of jars in the kitchen. The jars are magical ― if a chef that is cooking a dish requiring $x$ ingredients takes $x$ jars, each of these jars fills itself with one of the required ingredients, and after this chef finishes cooking and returns the jars to the kitchen, they empty themselves (and are ready for other chefs to take some or all of them). Of course, this means it is impossible to cook a dish requiring $x$ ingredients with less than $x$ jars.

Since Chef did not tell the junior chefs in which order they should prepare their dishes, they started picking up jars simultaneously and in the end, no junior chef was able to acquire enough jars to prepare their premier dish. Also, none of the junior chefs are willing to lend their jars to others. Chef was unable to handle the situation and decided to call off the cooking session for that day, so that he could get more jars and try it again later.

You know that there are $N$ junior chefs (numbered $1$ through $N$) and for each valid $i$, the number of ingredients required for the dish of the $i$-th chef is $A_{i}$. If there are $J$ jars, then formally, the following process happens:
The junior chefs take some jars; let's denote the number of jars taken by the $i$-th chef by $a_{i}$. Any distribution of jars such that $0 ≤ a_{i}$ for each valid $i$ and $\sum_{i=1}^N a_{i} = J$ is possible.
At any time, if $a_{i} < A_{i}$ for each chef $i$ that has not prepared their dish yet, the cooking session is a failure.
Otherwise, one of the chefs who have at least as many jars as the number of required ingredients prepares their dish and returns their jars to the kitchen.
Whenever some jars are returned to the kitchen, they are immediately taken by some chefs that have not prepared their dishes yet (possibly all the jars by one chef).
This process continues with chefs taking jars, cooking their dishes and returning jars, until no chef can cook their dish anymore or all chefs have cooked their dishes.
When all junior chefs have successfully cooked their dishes, the cooking session ends successfully.

Chef wants to know the minimum number of magical jars that should be present in the kitchen initially so that the session would be successful regardless of how the junior chefs pick up the jars. Chef is a legendary cook, but he is not very good at mathematics, so he asks you to find that number.

------  Input ------
The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.
The first line of each test case contains a single integer $N$.
The second line contains $N$ space-separated integers $A_{1}, A_{2}, \ldots, A_{N}$.

------  Output ------
For each test case, print a single line containing one integer ― the minimum required number of jars.

------  Constraints  ------
$1 ≤ T ≤ 1,000$
$1 ≤ N ≤ 10^{5}$
$1 ≤ A_{i} ≤ 10^{9}$ for each valid $i$
the sum of $N$ over all test cases does not exceed $10^{6}$

------  Subtasks ------
Subtask #1 (100 points): original constraints

----- Sample Input 1 ------ 
2   
4   
1 1 1 1   
2   
1 4
----- Sample Output 1 ------ 
1   
4
----- explanation 1 ------ 
Example case 1: One of the junior chefs always picks up the only jar, cooks their dish and returns the jar back to the kitchen. Then, another junior chef picks up that jar, cooks their dish and returns the jar. This procedure can be repeated by each junior chef so that they can cook their recipe.

Source: codechef | Difficulty: MEDIUM


Solutions:
t = int(input())
while t > 0:
	N = int(input())
	A = [int(x) for x in input().split()]
	sum = 0
	for ele in A:
		sum = sum + ele
	sumfinal = sum - len(A) + 1
	print(sumfinal)
	t -= 1


for _ in range(int(input())):
	n = int(input())
	l = [int(x) for x in input().split()]
	print(sum(l) - n + 1)


t = int(input())
for t1 in range(t):
	n = int(input())
	a = input().split()
	sum = 0
	for i in a:
		a1 = int(i)
		sum = sum + a1
	print(sum - n + 1)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	print(sum(arr) - n + 1)


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


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


for _ in range(int(input())):
	n = int(input())
	arr = [int(i) for i in input().split()]
	count = 1
	for x in arr:
		count += x - 1
	print(count)


def func(ele):
	count = 0
	for i in ele:
		count += i - 1
	return count + 1
n = int(input())
for _ in range(n):
	ele = int(input())
	list1 = list(map(int, input().split()))
	print(func(list1))


for i in range(int(input())):
	n = int(input())
	c = list(map(int, input().split()))
	sum1 = 0
	for items in c:
		sum1 = sum1 + items
	print(sum1 - n + 1)


for temp in range(int(input())):
	n = int(input())
	arr = [int(x) for x in input().split()]
	s = sum(arr)
	print(s - n + 1)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	if len(arr) == 1:
		print(arr[0])
	else:
		ans = sum([i - 1 for i in arr]) + 1
		print(ans)


def calc(A, n):
	return sum(A) - n + 1
for _ in range(int(input())):
	n = int(input())
	A = [int(x) for x in input().split()]
	print(calc(A, n))


t = int(input())
for i in range(t):
	n = int(input())
	l = [int(j) for j in input().split()]
	sum = 0
	for e in l:
		sum += e
	print(sum - n + 1)


for _ in range(int(input())):
	N = int(input())
	A = [int(x) for x in input().split()]
	ans = 0
	for i in range(N):
		ans += A[i] - 1
	print(ans + 1)


for _ in range(int(input())):
	n = int(input())
	arr = [int(x) for x in input().split()]
	ans = 0
	for num in arr:
		ans += num - 1
	print(ans + 1)


t = int(input())
while t:
	t -= 1
	n = int(input())
	arr = list(map(int, input().split()))
	print(sum(arr) - n + 1)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	Sum = 0
	for i in a:
		Sum += i
	print(Sum - n + 1)


tc = int(input())
for _ in range(tc):
	n = int(input())
	arr = [int(x) for x in input().split()]
	total = sum(arr)
	print(total - n + 1)


t = int(input())
for x in range(t):
	n = int(input())
	a = [int(c) for c in input().split()]
	ans = 0
	for i in a:
		ans += i - 1
	print(ans + 1)


for _ in range(int(input())):
	N = int(input())
	A = list(map(int, input().split()))
	count = 0
	for i in A:
		count += i - 1
	print(count + 1)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	s1 = sum(a)
	print(s1 - n + 1)


def magicalJars(arr, n):
	sum = 0
	for i in arr:
		sum += i - 1
	return sum + 1
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))[:n]
	print(magicalJars(arr, n))


t = int(input())
for _ in range(t):
	cooks = int(input())
	x = input().split(' ')[:cooks]
	y = [int(c) for c in x]
	print(sum(y) - cooks + 1)


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


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	res = 0
	for j in a:
		res += max(0, j - 1)
	print(res + 1)


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	ans = 0
	for i in a:
		ans += i - 1
	print(ans + 1)


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


for z in range(int(input())):
	n = int(input())
	print(sum(map(int, input().split())) - n + 1)


for _ in range(int(input())):
	N = int(input())
	total = 1
	A = list(map(int, input().split()))
	for i in A:
		total += i - 1
	print(total)


for i in range(int(input())):
	a = int(input())
	b = list(map(int, input().split()))
	s = 1
	for i in b:
		s += i - 1
	print(s)


for _ in range(int(input())):
	n = int(input())
	A = list(map(int, input().split()))
	A.sort()
	print(sum(A) - n + 1)


from sys import stdin
stdint = lambda : int(stdin.readline())
seq = lambda : list(map(int, stdin.readline().strip().split()))
for _ in range(stdint()):
	n = stdint()
	total = sum(seq())
	print(total - n + 1)


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


for T in range(int(input())):
	N = int(input())
	A = list(map(int, input().split()))
	print(sum(A) - (N - 1))


T = int(input())
for x in range(T):
	n = int(input())
	a = []
	for i in input().split():
		a.append(int(i))
	print(sum(a) - n + 1)


T = int(input())
for case in range(T):
	N = int(input())
	print(sum([int(i) for i in input().split()]) - N + 1)


t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	res = 0
	for num in arr:
		res += num - 1
	print(res + 1)


t = int(input())
while t > 0:
	n = int(input())
	arr = list(map(int, input().split()))
	s = 0
	for i in arr:
		s = s + i - 1
	print(s + 1)
	t -= 1


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	s = 0
	for j in a:
		s += j - 1
	print(s + 1)


t = int(input())
while t:
	n = int(input())
	ingredient = list(map(int, input().split()))
	print(sum(ingredient) - n + 1)
	t -= 1


t = int(input())
for i in range(t):
	l = int(input())
	arr = [int(x) for x in input().split()]
	print(sum(arr) - l + 1)


for _ in range(int(input())):
	n = int(input())
	c = [int(n) for n in input().split()]
	for i in range(n):
		c[i] = c[i] - 1
	print(sum(c) + 1)


from functools import reduce
for _ in range(int(input())):
	n = int(input())
	print(reduce(lambda x, y: x + y, map(int, input().split())) - n + 1)


t = int(input())
while t != 0:
	n = int(input())
	l = list(map(int, input().strip().split()))[:n]
	s = sum(l)
	print(s - n + 1)
	t -= 1


for _ in range(int(input())):
	c = int(input())
	L = list(map(int, input().split()))
	print(sum(L) - c + 1)