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
Tags: Mathematics

Greedy algorithms
Skill types: Greedy algorithms

Starter code:

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)


import math
t = int(input())
while t != 0:
	c = 0
	n = int(input())
	arr = [int(x) for x in input().split()]
	minm = min(arr)
	for i in range(n):
		if arr[i] >= minm * 2:
			x = arr[i] / (minm * 2 - 1)
			c += math.floor(x)
			if math.floor(x) == x:
				c -= 1
	print(c)
	t -= 1


for i in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	a = 0
	e = min(arr)
	for i in range(n):
		x = arr[i] + 2 * e - 2
		y = 2 * e - 1
		t = x // y
		if t > 1:
			a += t - 1
	print(a)


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


def solve():
	n = int(input())
	a = list(map(int, input().split(' ')))
	minm = min(a)
	thress = minm * 2 - 1
	ans = 0
	for i in range(1, n):
		if minm == 1:
			ans += a[i] - 1
		elif a[i] > thress:
			ans += (a[i] + thress - 1) // thress - 1
	print(ans)
t = int(input())
for i in range(t):
	solve()


for _ in range(int(input())):
	t = int(input())
	arr = list(map(int, input().split()))
	if t == 1:
		print(0)
		continue
	first = arr[0]
	res = 0
	if first != 1:
		for i in range(1, t):
			if arr[i] % (2 * first - 1) == 0:
				res -= 1
			res += arr[i] // (2 * first - 1)
	else:
		for i in range(1, t):
			res += arr[i] - 1
	print(res)


def getint():
	return [int(i) for i in input().split()]

def get():
	return int(input())

def S():
	for test in range(int(input())):
		solve()

def solve():
	import math
	n = get()
	a = getint()
	a.sort()
	mi = a[0]
	ma = a[-1]
	ans = 0
	for i in range(n):
		if a[i] / mi >= 2:
			x = math.ceil(a[i] / (mi * 2 - 1)) - 1
			ans += x
		else:
			continue
	print(ans)
S()


from math import ceil
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if n == 1:
		print(0)
	else:
		k = min(a) * 2 - 1
		steps = 0
		for i in a:
			if i > k:
				if i % k == 0:
					steps += i // k - 1
				else:
					steps += i // k
		print(steps)


import math

def solve():
	n = int(input())
	a = list(map(int, input().split()))
	n = a[0]
	m = 2 * n - 1
	count = []
	for i in a:
		if i < m:
			continue
		else:
			q = math.ceil(i / m)
			count.append(q - 1)
	return sum(count)
for t in range(0, int(input())):
	print(solve())


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 math
T = int(input())
for t in range(0, T):
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	ans = 0
	for i in range(1, n):
		if a[i] - (2 * a[0] - 1) >= 0:
			ans += math.ceil((a[i] - (2 * a[0] - 1)) / (2 * a[0] - 1))
	print(ans)


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


def N():
	return int(input())

def A():
	return [int(x) for x in input().split()]

def S():
	return input()
for _ in range(N()):
	n = N()
	if 't9gjt489i54gitrgu54te0ut89ut9' == 5485545947598347495:
		print('Tanmay')
	a = A()
	mini = 2 * min(a) - 1
	if mini == 0:
		print(sum(a) - n)
		continue
	c = 0
	for i in a:
		c += i // mini
		if not i % mini:
			c -= 1
			continue
	print(c)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().strip().split()))
	co = 0
	l.sort()
	a = l[0]
	b = 2 * a - 1
	for i in l:
		co += i // b
		if i % b == 0:
			co -= 1
	print(co)


t = input()
for i in range(int(t)):
	n = int(input())
	sizes = input().split()
	limit = int(sizes[0]) * 2 - 1
	step = 0
	for item in sizes:
		step += (int(item) - 1) // limit
	print(step)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	res = 0
	arr.sort()
	for k in arr:
		ctr = k + 2 * arr[0] - 2
		ctk = 2 * arr[0] - 1
		diff = ctr // ctk
		if diff > 1:
			res += ctr // ctk - 1
	print(res)


def ten_with_tangerines():
	n = int(input())
	lst_ans = []
	for i in range(n):
		len_1 = int(input())
		lst_1 = list(map(int, input().split()))
		min_1 = min(lst_1)
		ans = 0
		if lst_1[0] == 1:
			for y in lst_1:
				ans = ans + y - 1
		else:
			for u in lst_1:
				a = 0
				if u >= 2 * min_1:
					if u == 2 * min_1:
						a = 1
					elif u % (2 * min_1 - 1) == 0:
						a = u // (2 * min_1 - 1) - 1
					else:
						a = u // (2 * min_1 - 1)
				ans = ans + a
		lst_ans.append(ans)
	for u in lst_ans:
		print(u)
ten_with_tangerines()


for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	c = 0
	a = min(l) * 2 - 1
	for j in l:
		if j > a:
			if j % a == 0:
				c += j // a - 1
			else:
				c += j // a
	print(c)


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


t = int(input())
for i in range(0, t):
	m = int(input())
	l = [int(x) for x in input().split()]
	c = 0
	for i in range(1, m):
		if l[i] >= 2 * l[0]:
			c += l[i] // (2 * l[0] - 1)
			if l[i] % (2 * l[0] - 1) == 0:
				c -= 1
	print(c)


import math
for _ in range(int(input())):
	array_len = int(input())
	arr = list(map(int, input().split()))
	result = 0
	diff = arr[0] * 2
	min_piece = arr[0]
	for i in range(1, array_len):
		if arr[i] >= diff:
			count = math.ceil(arr[i] / (diff - 1)) - 1
			result += count
	print(result)


t = int(input())
while t:
	t -= 1
	n = int(input())
	arr = [int(i) for i in input().split()]
	mini = min(arr)
	ans = 0
	for i in arr:
		if i < 2 * mini:
			ans += 0
		else:
			ans += i // (2 * mini - 1) - 1 * (i % (2 * mini - 1) == 0)
	print(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')


(t, k, h) = (int(input()), 0, [])
for _ in range(t):
	n = int(input())
	s = input().split()
	s = [int(i) for i in s]
	for i in range(len(s)):
		if i != 0:
			if s[i] % (s[0] * 2 - 1) == 0:
				k += s[i] // (s[0] * 2 - 1)
				k -= 1
			else:
				k += s[i] // (s[0] * 2 - 1)
	h.append(k)
	k = 0
print(*h, 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)


t = int(input())
for _ in range(t):
	n = int(input())
	lst = list(map(int, input().split()))
	minm = min(lst)
	counter = 0
	for i in range(len(lst)):
		if lst[i] % (2 * minm - 1) == 0:
			counter += lst[i] // (2 * minm - 1) - 1
		else:
			counter += lst[i] // (2 * minm - 1)
	print(counter)


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


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


t = int(input())
for i in range(0, t):
	n = int(input())
	sizes = map(int, input().split())
	sizes = list(sizes)
	a1 = 2 * min(sizes) - 1
	sum = 0
	for i in range(0, n):
		p = int((sizes[i] - 1) / a1)
		sum += p
	print(sum)


T = int(input())
while T:
	n = int(input())
	arr = input().split()
	arr = [int(k) for k in arr]
	arr.sort()
	minn = 2 * arr[0] - 1
	ans = 0
	for x in arr:
		if (x + minn - 1) // minn > 1:
			ans += (x + minn - 1) // minn - 1
	print(ans)
	T -= 1


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


t = 0
n = int(input(''))
for i in range(n):
	t = 0
	m = int(input(''))
	s = input('')
	a = s.split(' ')
	a = list(map(int, a))
	for j in range(1, m):
		if a[j] / (a[0] * 2 - 1) == a[j] // (a[0] * 2 - 1):
			tmp = a[j] // (a[0] * 2 - 1) - 1
		else:
			tmp = a[j] // (a[0] * 2 - 1)
		t += tmp
	print(t)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	minn = min(a)
	k = 2 * minn - 1
	c = 0
	if minn == 1:
		for j in range(n):
			c += a[j] - 1
	else:
		for j in range(n):
			if a[j] >= k + 1:
				c += int(a[j] / k)
				if a[j] % k == 0:
					c -= 1
			else:
				pass
	print(c)


t = int(input())
for i in range(t):
	n = int(input())
	s = [int(x) for x in input().split()]
	count = 0
	for x in s:
		if x >= 2 * s[0]:
			c = x // (2 * s[0] - 1)
			if x % (2 * s[0] - 1) == 0:
				c -= 1
			count += c
	print(count)


test = int(input())
while test:
	test -= 1
	N = int(input())
	a = list(map(int, input().split()))
	a.sort()
	ans = 0
	m = min(a)
	m = 2 * m - 1
	if m == 1:
		ans = sum(a) - N
	else:
		for i in a:
			if i > m:
				if i % m == 0:
					ans += i // m - 1
				else:
					ans += i // m
	print(ans)


import math

def solve(n, arr):
	p = 2 * min(arr) - 1
	s = 0
	for i in range(n):
		s += math.ceil(arr[i] / p) - 1
	return s
for t in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	print(solve(n, arr))


import math
t = int(input())
for i in range(0, t):
	n = int(input())
	arr = input()
	arr = [int(x) for x in arr.split()]
	count = 0
	arr.sort()
	minn = arr[0]
	boundary = 2 * minn - 1
	for i in range(len(arr)):
		k = math.ceil(arr[i] / boundary)
		if k != 1:
			count += k - 1
	print(count)


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