There are $n$ pieces of tangerine peel, the $i$-th of them has size $a_i$. In one step it is possible to divide one piece of size $x$ into two pieces of positive integer sizes $y$ and $z$ so that $y + z = x$.

You want that for each pair of pieces, their sizes differ strictly less than twice. In other words, there should not be two pieces of size $x$ and $y$, such that $2x \le y$. What is the minimum possible number of steps needed to satisfy the condition?


-----Input-----

The first line of the input contains a single integer $t$ ($1 \le t \le 100$) — the number of test cases. The description of test cases follows.

The first line of each test case contains the integer $n$ ($1 \le n \le 100$).

Then one line follows, containing $n$ integers $a_1 \le a_2 \le \ldots \le a_n$ ($1 \le a_i \le 10^7$).


-----Output-----

For each test case, output a single line containing the minimum number of steps.


-----Examples-----

Input
3
5
1 2 3 4 5
1
1033
5
600 900 1300 2000 2550
Output
10
0
4


-----Note-----

In the first test case, we initially have a piece of size $1$, so all final pieces must have size $1$. The total number of steps is: $0 + 1 + 2 + 3 + 4 = 10$.

In the second test case, we have just one piece, so we don't need to do anything, and the answer is $0$ steps.

In the third test case, one of the possible cut options is: $600,\ 900,\ (600 | 700),\ (1000 | 1000),\ (1000 | 1000 | 550)$. You can see this option in the picture below. The maximum piece has size $1000$, and it is less than $2$ times bigger than the minimum piece of size $550$. $4$ steps are done. We can show that it is the minimum possible number of steps.

Difficulty: EASY

Solutions:
for _ in range(int(input())):
	ans = int()
	n = int(input())
	lis = list(map(int, input().split()))
	sm = min(lis) * 2 - 1
	for i in lis:
		if i > sm:
			if not i % sm:
				ans -= 1
				ans += i // sm
			else:
				ans += i // sm
	print(ans)


def one():
	n = int(input())
	a = list(map(int, input().split()))
	m = min(a) * 2 - 1
	print(sum((-(-x // m) for x in a)) - n)
t = int(input())
for i in range(t):
	one()


from math import ceil
for i in range(int(input())):
	input()
	a = list(map(int, input().split()))
	mn = min(a)
	mx = mn * 2 - 1
	k = sum([ceil(i / mx) - 1 for i in a])
	print(k)


import math
t = int(input())
results = []

def devide(arr, res):
	minimal = min(arr)
	minimal_val = minimal * 2 - 1
	if minimal == 1:
		for val in arr:
			if val == 1:
				pass
			res += val - 1
		return res
	for val in arr:
		if val <= minimal_val:
			pass
		res += math.ceil(val / minimal_val) - 1
	return res
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	if len(arr) == 1:
		results.append(0)
		continue
	res = devide(arr, 0)
	results.append(res)
list(map(print, results))


t = int(input())
while t > 0:
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	ans = 0
	for i in range(1, n, 1):
		if (a[i] + 2 * a[0] - 2) / (2 * a[0] - 1) > 1:
			ans += (a[i] + 2 * a[0] - 2) // (2 * a[0] - 1) - 1
	t = t - 1
	print(ans)


n = int(input())
h = []
for i in range(n):
	n = int(input())
	a = list(map(int, input().split()))
	a = sorted(a)
	k = 0
	f = a[0] * 2
	i = 0
	while i < n:
		g = a[i]
		d = 1
		if g >= f:
			if f > 2:
				if g % (f - 1) == 0:
					k1 = g // (f - 1) - 1
				else:
					k1 = g // (f - 1)
				k = k1 + k
			else:
				k1 = g // (f // 2)
				k = k1 + k - 1
		i = i + 1
	h.append(k)
for t in h:
	print(t)


from math import ceil
for _ in range(int(input())):
	(n, l) = (int(input()), [*map(int, input().split())])
	x = 2 * l[0] - 1
	print(sum((ceil((i - x) / x) for i in l if i > x)))


t = int(input())
for t1 in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	ans = 0
	bound = min(a) * 2 - 1
	for x in a:
		if x > bound:
			ans += x // bound
			if x % bound == 0:
				ans -= 1
	print(ans)


for s in [*open(0)][2::2]:
	a = (*map(int, s.split()),)
	m = 2 * min(a) - 1
	print(-sum((-x // m + 1 for x in a)))


for _ in range(int(input())):
	n = int(input())
	l1 = list(map(int, input().split()))
	num = l1[0] * 2 - 1
	sum = 0
	for i in range(1, len(l1)):
		if l1[i] % num == 0:
			a = l1[i] // num - 1
			sum += a
		else:
			sum += l1[i] // num
	print(sum)


def inp():
	return int(input())

def strng():
	return input().strip()

def jn(x, l):
	return x.join(map(str, l))

def strl():
	return list(input().strip())

def mul():
	return map(int, input().strip().split())

def mulf():
	return map(float, input().strip().split())

def seq():
	return list(map(int, input().strip().split()))

def ceil(x):
	return int(x) if x == int(x) else int(x) + 1

def ceildiv(x, d):
	return x // d if x % d == 0 else x // d + 1
import math
for i in range(inp()):
	n = inp()
	lst = seq()
	m = lst[0] * 2 - 1
	cnt = 0
	for i in range(1, n):
		p = math.ceil(lst[i] / m)
		if p > 1:
			cnt += p - 1
	print(cnt)


for str in [*open(0)][2::2]:
	n = (*map(int, str.split()),)
	M = 2 * min(n) - 1
	print(-sum((-x // M + 1 for x in n)))


for S in [*open(0)][2::2]:
	N = (*map(int, S.split()),)
	m = 2 * min(N) - 1
	print(-sum((-x // m + 1 for x in N)))


from math import ceil
t = int(input())
for i in range(t):
	n = int(input())
	pieces = [int(x) for x in input().split()]
	pieces.sort()
	s = min(pieces)
	cuts = 0
	for p in pieces[1:]:
		if p >= 2 * s:
			k = ceil(p / (s * 2 - 1))
			cuts += k - 1
	print(cuts)


def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		count = 0
		list = input()
		first = ''
		for j in range(len(list)):
			if list[j] == ' ':
				break
			first += list[j]
		list = list.split()
		if int(first) == 1:
			for j in range(n):
				count += int(list[j]) - 1
		else:
			double = int(first) * 2
			for j in range(n):
				count += int(int(list[j]) / (double - 0.9999999))
		print(count)
main()


t = int(input())
for _ in range(t):
	n = int(input())
	arr = input().split()
	arr = [int(i) for i in arr]
	_sum = 0
	mod = 2 * arr[0] - 1
	r = mod - 1
	for num in arr[1:]:
		_sum += (num + r) // mod - 1
	print(_sum)


import sys
R = sys.stdin.readline
for _ in range(int(R())):
	(n, res) = (int(R()), 0)
	t = [*map(int, R().split())]
	for i in range(1, n):
		res += (t[i] - 1) // (2 * t[0] - 1)
	print(res)


t = int(input())
for test in range(t):
	n = int(input())
	a = list(input().split())
	for b in range(n):
		a[b] = int(a[b])
	a = sorted(a)
	m = 2 * a[0] - 1
	res = 0
	for i in range(1, n):
		if a[i] % m == 0:
			res += a[i] // m - 1
		else:
			res += a[i] // m
	print(res)


import sys
input = lambda : sys.stdin.readline().rstrip()
import math
from functools import lru_cache
t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	mn = min(arr)
	mn = mn * 2 - 1
	a = 0
	for el in arr:
		if el > mn:
			a += el // mn
			if el % mn == 0:
				a -= 1
	print(a)


def getResult(n, a_list):
	amin = min(a_list)
	ans = 0
	for a in a_list:
		ans += (a - 1) // (2 * amin - 1)
	return ans
for _ in range(int(input())):
	n = int(input())
	a_list = [int(k) for k in input().split()]
	print(getResult(n, a_list))


from math import ceil
for _ in range(int(input())):
	n = int(input())
	lst = list(map(int, input().split()))
	m = min(lst) * 2 - 1
	cnt = 0
	for i in lst:
		cnt += ceil(i / m) - 1
	print(cnt)


from math import ceil
t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(x) for x in input().split(' ')]
	mn = min(arr)
	mx = mn * 2 - 1
	cuts = 0
	for val in arr:
		cuts += ceil(val / mx) - 1
	print(cuts)


import sys
import math
flh = sys.stdin
test_cases = int(flh.readline())
res = []
for case in range(test_cases):
	n = int(flh.readline())
	a = [int(x) for x in flh.readline().strip().split()]
	m = 2 * min(a) - 1
	res = 0
	for i in a:
		res += math.ceil(i / m) - 1
	print(res)


t = int(input())
for _ in range(t):
	n = int(input())
	lst = list(map(int, input().split()))
	lst.sort()
	ans = 0
	for i in range(1, n):
		ans += (lst[i] + lst[0] * 2 - 2) // (lst[0] * 2 - 1) - 1
	print(ans)


for jj in range(int(input())):
	n = int(input())
	arr = [int(i) for i in input().split()]
	if n == 1:
		print(0)
	else:
		ans = 0
		t = arr[0]
		for i in range(1, n):
			if arr[i] >= t * 2:
				if arr[i] % (t + t - 1) == 0:
					ans += arr[i] // (t + t - 1) - 1
				else:
					ans += arr[i] // (t + t - 1)
		print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	ans = 0
	a = list(map(int, input().split()))
	mini = a[0] * 2 - 1
	for aa in a:
		if aa > mini:
			ans += aa // mini
			if aa % mini == 0:
				ans -= 1
	print(ans)


from math import ceil
t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	mi = min(a)
	tot = 0
	for i in range(n):
		if a[i] >= mi * 2:
			if a[i] % (2 * mi - 1) == 0:
				tot += a[i] // (2 * mi - 1) - 1
			else:
				tot += a[i] // (2 * mi - 1)
	print(tot)


import sys
input = sys.stdin.readline

def solve():
	n = int(input())
	arr = list(map(int, input().split()))
	v = arr[0]
	ans = 0
	for i in range(1, n):
		if arr[i] < 2 * v:
			continue
		ans += arr[i] // (2 * v - 1) - 1
		ans += 1 if arr[i] % (2 * v - 1) else 0
	return ans
for _ in range(int(input())):
	print(solve())


from math import ceil

def main():
	n = int(input())
	arr = list(map(int, input().split()))
	mn = min(arr)
	allow = 2 * mn - 1
	ans = 0
	for z in arr:
		ans += ceil(z / allow) - 1
	return ans
for _ in range(int(input())):
	print(main())


import math
for t in range(int(input())):
	n = int(input())
	lst = list(map(int, input().split(' ')))
	res = 2 * min(lst) - 1
	ans = 0
	for i in lst:
		ans += math.ceil(i / res) - 1
	print(ans)


from math import ceil
t = int(input())
for i in range(t):
	a = int(input())
	b = list(map(int, input().split()))
	step = 0
	x = min(b)
	for i in b:
		step += ceil(i / (2 * x - 1)) - 1
	print(step)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	k = min(arr)
	res = 0
	for el in arr:
		res += el // (2 * k - 1)
		if el % (2 * k - 1) == 0:
			res -= 1
	print(res)


from math import ceil
t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	m = a[0]
	sol = 0
	for ai in a:
		sol += ceil(ai / (2 * m - 1)) - 1
	print(sol)


import math
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	m = 2 * min(a) - 1
	ans = 0
	for i in a:
		ans += math.ceil(i / m) - 1
	print(ans)


def slice(arr, N):
	limit = 2 * arr[0] - 1
	opertarions = 0
	for x in arr[1:]:
		if x < limit:
			continue
		opertarions += (x - 1) // limit
	return opertarions
OUTPUT = []
for _ in range(int(input())):
	N = int(input())
	arr = [int(x) for x in input().split()]
	OUTPUT.append(slice(arr, N))
for _ in OUTPUT:
	print(_)


t = int(input())
for q in range(t):
	n = int(input())
	count = 0
	l = input().split()
	l1 = []
	for k in l:
		l1.append(int(k))
	l1.sort()
	div = 2 * l1[0] - 1
	for i in range(1, n):
		count += (l1[i] - 1) // div
	print(count)


t = int(input())
for _ in range(t):
	n = int(input())
	A = list(map(int, input().split()))
	a = A[0]
	ans = 0
	for i in range(1, n):
		b = A[i] / (2 * a - 1)
		ans += -1 + int(b) + 1 * (int(b) < b)
	print(ans)


tttt = int(input())

def k(x, mn):
	mn = 2 * mn - 1
	ans = x // mn
	if x % mn == 0:
		ans -= 1
	return ans
for ttt in range(tttt):
	n = int(input())
	a = [int(i) for i in input().split()]
	a.sort()
	a.reverse()
	mn = a[-1]
	ans = 0
	for i in range(n):
		ans += k(a[i], mn)
	print(ans)


t = int(input())
for q in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a = sorted(a)
	C = 2 * a[0] - 1
	s = 0
	for x in a:
		if x >= a[0] + 1:
			f = 0
			if x % C == 0:
				f = 1
			s += x // C - f
	print(s)


for _ in range(int(input())):
	(n, a) = (int(input()), tuple(map(int, input().split())))
	max_value = min(a) * 2 - 1
	print(sum(((x + max_value - 1) // max_value - 1 for x in a)))


class T:

	def solve(self):
		n = int(input())
		a = sorted(list(map(int, input().split())))
		(ans, ele) = (0, a[0])
		for i in range(n):
			temp = (a[i] + 2 * ele - 2) // (2 * ele - 1)
			if temp > 1:
				ans += temp - 1
		return ans
for t in range(int(input())):
	obj = T()
	print(obj.solve())


t = eval(input())
import math
for i in range(t):
	n = eval(input())
	c = 0
	a = list(map(int, input().split()))
	a.sort()
	k = a[0] * 2 - 1
	for i in range(1, n):
		c += math.ceil(a[i] / k) - 1
	print(c)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	mi = min(arr)
	limit = mi * 2 - 1
	ans = 0
	for i in arr:
		if i % limit == 0:
			ans += i // limit - 1
		else:
			ans += i // limit
	print(ans)


for _ in range(int(input())):
	a = int(input())
	b = [int(I) for I in input().split()]
	b.sort()
	count = 0
	for i in range(1, len(b)):
		c = 2 * b[0]
		d = (b[i] + c - 2) // (c - 1)
		if d > 1:
			count += d - 1
	print(count)


t = int(input())
for r in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	di = 2 * min(l) - 1
	s = 0
	for i in l:
		d = i // di
		if i % di == 0:
			d -= 1
		s += d
	print(s)


t = int(input())
for _ in range(t):
	n = int(input())
	nums = list(map(int, input().split()))
	x = min(nums)
	k = 2 * x - 1
	res = 0
	for y in nums:
		if y <= k:
			continue
		res += (y + k - 1) // k - 1
	print(res)


import math
ntestcases = int(input())
for i in range(ntestcases):
	n = int(input())
	sizes = list(map(int, input().split()))
	smolest_tangerine = min(sizes)
	maxSize = smolest_tangerine * 2 - 1
	steps = 0
	for size in sizes:
		steps += math.ceil(size / maxSize) - 1
	print(steps)


from math import ceil
test = int(input())
for t in range(test):
	n = int(input())
	A = list(map(int, input().split()))
	p = A[0]
	ans = 0
	for i in range(1, n):
		if A[i] > 2 * p - 1:
			ans += ceil(A[i] / (2 * p - 1)) - 1
	print(ans)


n_tests = int(input().strip())
for _ in range(n_tests):
	n = int(input())
	a = [int(i) for i in input().strip().split()]
	minsize = min(a)
	maxsize = minsize * 2 - 1
	num_step = 0
	for piece in a:
		if piece <= maxsize:
			continue
		else:
			num_step += piece // maxsize + int(piece % maxsize != 0) - 1
	print(num_step)


from math import ceil

def solve(n, arr):
	bound = arr[0] * 2 - 1
	sum = 0
	for num in arr:
		sum += ceil(num / bound) - 1
	return sum
test = int(input())
for i in range(test):
	n = int(input())
	arr = list(map(int, input().split(' ')))
	c = solve(n, arr)
	print(c)


def fun(i, x):
	if i % x == 0:
		return i // x - 1
	return i // x
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	x = 2 * min(a) - 1
	s = 0
	for i in a:
		s += fun(i, x)
	print(s)


import math
t = int(input())
for _ in range(t):
	k = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	b = 2 * arr[0] - 1
	c = 0
	d = len(arr)
	for i in arr:
		c += math.ceil(i / b)
	print(c - d)


import math
N = int(input())
for _ in range(N):
	n = int(input())
	A = [int(x) for x in input().split(' ')]
	A = sorted(A)
	if n == 1:
		print(0)
		continue
	Q = 2 * A[0] - 1
	ans = 0
	for i in range(1, n):
		if A[i] >= 2 * A[0]:
			ans += math.ceil(A[i] / Q) - 1
	print(f'{ans}')


import math
T = int(input())
for i in range(T):
	N = int(input())
	A = [int(x) for x in input().split()]
	res = 0
	small = 2 * min(A) - 1
	for i in A:
		if i > small:
			res += math.ceil(i / small) - 1
	print(res)


import heapq
cases = int(input())
for _ in range(cases):
	_ = input()
	peaces = list(map(int, input().split()))
	peaces.reverse()
	upper_bound = peaces[-1]
	steps = 0
	for peace in peaces:
		if peace < 2 * upper_bound:
			break
		steps += (peace - 1) // (2 * upper_bound - 1)
	print(steps)


import math
for _ in range(int(input())):
	n = int(input())
	ans = 0
	a = [*map(int, input().split())]
	a.sort()
	d = a[0] * 2
	for i in a:
		if i >= d:
			ans += math.ceil(i / (d - 1)) - 1
	print(ans)


test = int(input())
for t in range(test):
	n = int(input())
	a = list(map(int, input().split()))
	min_a = a[0]
	max_a = min_a * 2
	score = 0
	for i in range(1, n):
		if a[i] < max_a:
			pass
		else:
			score += a[i] // (max_a - 1)
			if a[i] % (max_a - 1) != 0:
				score += 1
			score -= 1
	print(score)


from math import ceil
ans = []
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	mi = min(a) * 2 - 1
	su = 0
	for e in a:
		su += ceil(e / mi)
	ans.append(str(su - n))
print('\n'.join(ans))


import sys, math
sys.setrecursionlimit(1000000)
res = []
for _ in range(int(input())):
	a = int(input())
	b = list(map(int, input().split()))
	smallest = min(b)
	res.append(sum([max(0, math.ceil((i - (2 * smallest - 1)) / (2 * smallest - 1))) for i in b]))
print(*res, sep='\n')


for _ in range(int(input())):
	n = int(input())
	nn = 0
	a = list(map(int, input().split()))
	a.sort()
	for i in range(1, n):
		if a[i] >= a[0] + a[0]:
			if a[i] % (a[0] + a[0] - 1) == 0:
				nn = nn + int(a[i] / (a[0] + a[0] - 1)) - 1
			else:
				nn = nn + int(a[i] / (a[0] + a[0] - 1))
	print(int(nn))


from math import floor
for _ in range(int(input())):
	input()
	a = list(map(int, input().split()))
	q = a[0]
	p = a[0] * 2 - 1
	cuts = 0
	for i in range(1, len(a)):
		peel = a[i]
		if peel % p == 0:
			cuts += floor(peel / p - 1)
		else:
			cuts += floor(peel / p)
	print(cuts)