Rohit has n empty boxes lying on the ground in a line. The size of the boxes is given in the form of an array $a$. The size of the ith box is denoted by $a[i]$. Since Rohit has a tiny room, there is a shortage of space. Therefore, he has to reduce the number of boxes on the ground by putting a box into another box that is at least twice the size of the current box i.e if we have to put the ith box into the jth box then $( 2*a[i] ) <= a[j]$.
Each box can contain a maximum of one box and the box which is kept in another box cannot
hold any box itself.
Find the minimum number of boxes that will remain on the ground after putting boxes into each other.

-----Input:-----
- The first line contains a single integer n.
- The next n lines contain the integer a[i] - the size of the i-th box.

-----Output:-----
Output a single integer denoting the minimum number of boxes remaining on the ground.

-----Constraints-----
- $1 \leq n \leq 5*10^5$
- $1 \leq a[i] \leq 10^5$

-----Subtasks-----
- 30 points : $1 \leq n \leq 10^2$
- 70 points : $1 \leq n \leq 5*10^5$

-----Sample Input:-----
5
16
1
4
8
2

-----Sample Output:-----
3

Source: codechef | Difficulty: UNKNOWN_DIFFICULTY


Solutions:
n = int(input())
l = [0] * n
for i in range(n):
	l[i] = int(input())
l.sort()
s = 0
i = n - 1
while i >= 0:
	x = 2 * l[i]
	if l[-1] >= x:
		j = i
		while j < len(l):
			if l[j] >= x:
				l.pop(j)
				l.pop(i)
				s += 1
				break
			j += 1
	i -= 1
s += len(l)
print(s)


def remove_values_from_list(the_list, val):
	return [value for value in the_list if value != val]
n = int(input())
l = []
box = 0
for i in range(n):
	a = int(input())
	l.append(a)
l.sort(reverse=True)
for i in range(n):
	if l[i] != 0:
		for j in range(1, n):
			if l[j] != 0:
				if l[j] * 2 <= l[i]:
					box = box + 1
					l[i] = 0
					l[j] = 0
					break
l = remove_values_from_list(l, 0)
print(box + len(l))


import sys
boxes_number = int(sys.stdin.readline().rstrip())
boxes_sizes = list(map(int, sys.stdin.readlines()))
boxes_sizes.sort()
(lower_bound, upper_bound) = (0, boxes_number // 2 + 1)
while lower_bound + 1 < upper_bound:
	middle = lower_bound + upper_bound >> 1
	possible = not middle or all((2 * boxes_sizes[i] <= boxes_sizes[boxes_number - middle + i] for i in range(middle)))
	if not possible:
		upper_bound = middle
	else:
		lower_bound = middle
print(boxes_number - lower_bound)


n = int(input())
l = []
for _ in range(n):
	l.append(int(input()))
l.sort()
l.reverse()
i = 0
count = 0
while i < len(l):
	s = l[i]
	l1 = l[i + 1:len(l)]
	if len(l1) != 0 and s >= 2 * l1[len(l1) - 1]:
		for j in l1:
			if s >= 2 * j:
				l.remove(j)
				break
	count += 1
	i += 1
print(count)


from collections import defaultdict
n = int(input())
l = []
for i in range(n):
	l.append([int(input()), 0])
l.sort(key=lambda x: x[0], reverse=True)
ans = 0
y = 0
for i in range(n):
	if l[i][1] == 1:
		continue
	for j in range(max(y, i + 1), n):
		if l[j][1] == 0 and 2 * l[j][0] <= l[i][0]:
			l[j][1] = 1
			l[i][1] = 1
			ans += 1
			break
		y = j
for i in range(n):
	if l[i][1] == 0:
		ans += 1
print(ans)


n = int(input())
lst = []
for i in range(n):
	lst.append(int(input()))
lst.sort()
mini = abs(-n // 2)
(f_l, s_l) = (lst[:mini], lst[mini:])
ans = 0
j = 0
i = 0
extra = 0
while i < len(f_l) and j < len(s_l):
	if f_l[i] * 2 <= s_l[j]:
		ans += 1
		i += 1
		j += 1
	else:
		extra += 1
		j += 1
ans += len(s_l) - j + len(f_l) - i + extra
print(ans)


n = int(input())
lis = []
for _ in range(n):
	size = int(input())
	lis.append(size)
lis.sort()
lis.reverse()
j = 1
val = [True for _ in range(n)]
i = 0
cnt = n
if n == 1:
	print(1)
elif lis[0] == lis[n - 1]:
	print(n)
else:
	while i < n and j < n:
		if val[i] != True:
			i += 1
			continue
		if val[j] != True:
			j += 1
			continue
		if lis[j] * 2 <= lis[i]:
			val[i] = False
			val[j] = False
			i += 1
			j += 1
			cnt -= 1
		else:
			j += 1
	print(cnt)