Initially, you have the array $a$ consisting of one element $1$ ($a = [1]$).

In one move, you can do one of the following things:

  Increase some (single) element of $a$ by $1$ (choose some $i$ from $1$ to the current length of $a$ and increase $a_i$ by one);  Append the copy of some (single) element of $a$ to the end of the array (choose some $i$ from $1$ to the current length of $a$ and append $a_i$ to the end of the array). 

For example, consider the sequence of five moves:

  You take the first element $a_1$, append its copy to the end of the array and get $a = [1, 1]$.  You take the first element $a_1$, increase it by $1$ and get $a = [2, 1]$.  You take the second element $a_2$, append its copy to the end of the array and get $a = [2, 1, 1]$.  You take the first element $a_1$, append its copy to the end of the array and get $a = [2, 1, 1, 2]$.  You take the fourth element $a_4$, increase it by $1$ and get $a = [2, 1, 1, 3]$. 

Your task is to find the minimum number of moves required to obtain the array with the sum at least $n$.

You have to answer $t$ independent test cases.


-----Input-----

The first line of the input contains one integer $t$ ($1 \le t \le 1000$) — the number of test cases. Then $t$ test cases follow.

The only line of the test case contains one integer $n$ ($1 \le n \le 10^9$) — the lower bound on the sum of the array.


-----Output-----

For each test case, print the answer: the minimum number of moves required to obtain the array with the sum at least $n$.


-----Example-----
Input
5
1
5
42
1337
1000000000

Output
0
3
11
72
63244

Difficulty: EASY
Tags: Sorting

Mathematics

Constructive algorithms
Skill types: Sorting

Starter code:

Solutions:
from math import ceil, sqrt

def fun(a):
	if a % 2 == 0:
		return (a // 2 + 1) * (a // 2 + 1)
	else:
		return (a + 1) // 2 * ((a + 3) // 2)
for t in range(int(input())):
	n = int(input())
	i = int(sqrt(n)) * 2
	if fun(i - 2) >= n:
		print(i - 2)
	elif fun(i - 1) >= n:
		print(i - 1)
	elif fun(i) >= n:
		print(i)
	elif fun(i + 1) >= n:
		print(i + 1)
	else:
		print(i + 2)


def si():
	return input()

def ii():
	return int(input())

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

def mi():
	return map(int, input().split())

def out(v):
	print(v)

def spout():
	print(v, end=' ')

def d2b(n):
	return bin(n).replace('0b', '')

def twod(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def vow():
	return ['a', 'e', 'i', 'o', 'u']

def let():
	return [chr(i) for i in range(97, 123)]

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def ispow2(x):
	return x and (not x & x - 1)

def prime_factors(n):
	i = 2
	factors = []
	while i * i <= n:
		if n % i:
			i += 1
		else:
			n //= i
			factors.append(i)
	if n > 1:
		factors.append(n)
	return list(factors)
t = ii()
while t:
	t -= 1
	n = ii()
	rt = int(pow(n, 0.5))
	if rt * rt >= n:
		print(2 * rt - 2)
	elif (rt + 1) * rt >= n:
		print(2 * rt - 1)
	else:
		print(2 * rt)


t = int(input())
while t != 0:
	n = int(input())
	a = int(n ** 0.5)
	c = a - 1
	x = a
	while x < n:
		x += a
		c += 1
	print(c)
	t -= 1


import math

def print_result(ans):
	print(ans)

def solve(n):
	x = math.floor(math.sqrt(n))
	return x + math.ceil(n / x) - 2
t = int(input())
for i in range(1, t + 1):
	n = int(input())
	ans = solve(n)
	print_result(ans)


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	s = [n - 1]
	for i in range(2, n + 1):
		a = i - 1
		if n % i == 0:
			a += n // i - 1
		else:
			a += n // i
		s.append(a)
		if s[-1] > s[-2]:
			break
	print(min(s))


from math import ceil
n = int(input())
for _ in range(n):
	n = int(input())
	print(ceil((n ** 0.5 - 1) * 2))


import math
t = int(input())
while t > 0:
	t -= 1
	l = list(map(int, input().split()))
	n = l[0]
	if n == 1:
		print(0)
		continue
	if n == 2:
		print(1)
		continue
	divider = int(math.ceil(math.sqrt(n)))
	reminder = 0
	if n % divider > 0:
		reminder = 1
	ans = divider - 1 + (n // divider - 1) + reminder
	print(ans)


from math import ceil
for test in range(int(input())):
	n = int(input())
	ans = int(n ** 0.5) - 1
	ans = ans + ceil((n - (ans + 1)) / (ans + 1))
	print(ans)


import math
t = int(input())
for ts in range(t):
	n = int(input())
	sr = int(math.sqrt(n))
	c = 0
	c += sr - 1
	c += math.ceil((n - sr) / sr)
	print(c)


import math
for i in range(int(input())):
	number = int(input())
	upper_limit = math.ceil(number ** (1 / 2))
	if upper_limit > 25:
		(bl, al) = (upper_limit - 6, upper_limit + 6)
	else:
		bl = 1
		if upper_limit + 6 > number:
			al = upper_limit + 1
		else:
			al = upper_limit + 6
	answers = []
	for n in range(bl, al):
		answers.append(n - 1 + math.ceil((number - n) / n))
	print(min(answers))


t = int(input())
for i in range(t):
	n = int(input())
	n_2 = n ** 0.5
	n_l = int(n_2 // 1)
	n_h = int(n_l + (1 if n_2 % 1 else 0))
	t = n_l + n_h - 2
	if n_l * n_h >= n:
		print(t)
	else:
		print(t + 1)


def moves(n):
	r = float('inf')
	a = 1
	if n == 1:
		return 0
	while True:
		a += 1
		k = n // a + bool(n % a)
		if a + k - 2 > r:
			return r
		r = a + k - 2
for _ in range(int(input())):
	n = int(input())
	print(moves(n))


t = int(input())
k = [[0] for i in range(t)]
a = [[0] for i in range(t)]
for i in range(t):
	a[i] = int(input())
	b0 = a[i] ** (1 / 2) // 1
	if b0 * b0 >= a[i]:
		k[i] = 2 * b0 - 2
	elif a[i] == 1:
		k[i] = 0
	elif b0 * (b0 + 1) >= a[i]:
		k[i] = 2 * b0 - 1
	else:
		k[i] = 2 * b0
for i in range(t):
	print(int(k[i]))


t = int(input())
for i in range(t):
	n = int(input())
	data = []
	for i in range(1, int(n ** 0.5) + 1):
		data += [(n - i - 1) // i + i]
	print(min(data))


import sys
import math, bisect
from collections import defaultdict
from itertools import groupby, accumulate
from heapq import heapify, heappop, heappush
from collections import deque, Counter, OrderedDict

def I():
	return int(sys.stdin.readline())

def neo():
	return map(int, input().split())

def Neo():
	return list(map(int, input().split()))
for _ in range(int(input())):
	n = I()
	t = int(n ** 0.5)
	Ans = t - 1 + math.ceil((n - t) / t)
	print(Ans)


import sys
import math
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	x = int(input())
	steps = 0
	tot = 1
	m = 1
	best = 99999999999999999
	b_steps = 0
	if tot == x:
		best = 0
		print(0)
	else:
		steps = max(0, int(x ** 0.5 - 1000))
		tot = steps + 1
		m = steps + 1
		while tot < x:
			dd = x - tot
			gg = math.ceil(dd / m)
			if steps + gg < best:
				best = min(best, steps + gg)
				b_steps = steps
			m += 1
			tot += 1
			steps += 1
			if m > x ** 0.5:
				break
		print(best)


import math
t = int(input())
for i in range(t):
	n = int(input())
	if n == 1:
		print('0')
	elif n == 5:
		print('3')
	else:
		a = math.sqrt(n)
		a1 = int(a)
		if a1 * a1 == n:
			print(int(a * 2) - 2)
		else:
			print(int(a * 2) - 1)


import math
for _ in range(int(input())):
	n = int(input())
	if n == 1:
		print(0)
	else:
		m = int(n ** 0.5)
		print(math.ceil(n / m - 1 + m - 1))


from math import ceil
t = int(input())
for i in range(t):
	n = int(input())
	m = max(int(n ** 0.5) - 2, 0)
	ans = n
	for i in range(m, m + 5):
		for j in range(m, m + 5):
			if (1 + i) * (1 + j) >= n:
				ans = min(ans, i + j)
	print(ans)


for _ in range(int(input())):
	n = int(input())
	k = list()
	for i in range(max(int(n ** (1 / 2)) - 5, 1), int(n ** (1 / 2)) + 6):
		k.append(i - 1 + (n - 1) // i)
	print(min(k))


from math import ceil, sqrt
for _ in range(int(input())):
	n = int(input())
	if n == 1:
		print(0)
	else:
		m = sqrt(n)
		print(ceil(m) + round(m) - 2)


from math import sqrt
for _ in range(int(input())):
	n = int(input())
	ic = 1000000000
	ss = int(sqrt(n)) + 1
	while ss * (ss + 1) >= n:
		ss -= 1
	ss += 1
	if ss * ss >= n:
		ic = 2 * ss - 2
	print(min(ic, 2 * ss - 1))


t = int(input())
for _ in range(t):
	n = int(input())
	mx = int(n ** (1 / 2) + 1e-08)
	cnt = (n - 1) // mx
	print(cnt + mx - 1)


from sys import stdin, stdout, setrecursionlimit
from collections import deque, defaultdict, Counter
from heapq import heappush, heappop
from functools import lru_cache
import math
rl = lambda : stdin.readline()
rll = lambda : stdin.readline().split()
rli = lambda : map(int, stdin.readline().split())
rlf = lambda : map(float, stdin.readline().split())
(INF, NINF) = (float('inf'), float('-inf'))
MOD = 10 ** 9 + 7

def main():
	T = int(rl())
	f = lambda n, m: m + int(math.ceil(n / m)) - 2
	for _ in range(T):
		t = int(rl())
		sqrt = math.sqrt(t)
		(a, b) = (math.floor(sqrt), math.ceil(sqrt))
		aval = f(t, a)
		bval = f(t, b)
		if aval <= bval:
			print(aval)
		else:
			print(bval)
	stdout.close()
main()


from math import sqrt, ceil

def f(n, k):
	return k - 1 + ceil((n - k) / k)
t = int(input())
for t0 in range(t):
	n = int(input())
	k = int(sqrt(n))
	m = min(f(n, k), f(n, k + 1))
	if k >= 2:
		m = min(m, f(n, k - 1))
	print(m)


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import *
from copy import *
from collections import deque
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192
from sys import stderr

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def pow(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res
from functools import reduce

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

def gcd(a, b):
	if a == b:
		return a
	while b > 0:
		(a, b) = (b, a % b)
	return a
from collections import defaultdict

def solve():
	n = int(inp())

	def f(k):
		if k == 0:
			return float('inf')
		return ceil(n / k) + k - 2
	t1 = int(n ** 0.5)
	t2 = t1 + 1
	t3 = t1 - 1
	k1 = f(t1)
	k2 = f(t2)
	k3 = f(t3)
	print(min(k1, k2, k3))
testcase(int(inp()))


import sys
import math
import collections
import operator as op
from collections import deque
from math import gcd, inf, sqrt, pi, cos, sin, ceil, log2
from bisect import bisect_right, bisect_left
from functools import reduce
from sys import stdin, stdout, setrecursionlimit
setrecursionlimit(2 ** 20)

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer // denom

def prime_factors(n):
	i = 2
	factors = []
	while i * i <= n:
		if n % i:
			i += 1
		else:
			n //= i
			factors.append(i)
	if n > 1:
		factors.append(n)
	return list(factors)

def sumDigits(no):
	return 0 if no == 0 else int(no % 10) + sumDigits(int(no / 10))
MOD = 1000000007
PMOD = 998244353
N = 10 ** 9 + 7
LOGN = 30
T = 1
T = int(stdin.readline())
for _ in range(T):
	n = int(stdin.readline())
	print(ceil(2 * sqrt(n)) - 2)


import math
for _ in range(int(input())):
	n = int(input())
	x = int(math.sqrt(n))
	ans = float('inf')
	for i in range(-5, 6):
		a = x + i
		if a > 0:
			ans = min(ans, a - 1 + (n - 1) // a)
	print(ans)


from math import *
for _ in ' ' * int(input()):
	a = int(input())
	print(ceil((sqrt(a) - 1) * 2))


import os
import sys
from io import BytesIO, IOBase

def solution():
	n = int(input())
	val = n ** 0.5
	ans = int(2 * val - 1)
	if val == int(val):
		ans -= 1
	print(ans)
	return

def main():
	testcases = 1
	testcases = int(input())
	for _ in range(testcases):
		solution()
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


from math import ceil

def find(n):
	if n == 0 or n == 1:
		return 0
	elif n == 2:
		return 1
	minn = n - 1
	k = 2
	value = k - 1 + (n // k - 1)
	while minn > value:
		if minn > value:
			minn = value
			if n % k != 0:
				minn += 1
		k += 1
		value = k - 1 + (n // k - 1)
	return minn
for _ in range(int(input())):
	n = int(input())
	print(find(n))


from math import ceil
for _ in range(int(input())):
	n = int(input())
	if n == 1:
		print(0)
		continue
	steps = ceil(2 * (-1 + n ** 0.5))
	print(steps)


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

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

def insr():
	s = input()
	return list(s[:len(s)])

def invr():
	return map(int, input().split())
n = inp()
for i in range(n):
	val = inp()
	cnt = 1
	prev = 10 ** 10
	while True:
		if (val + cnt - 1) // cnt + cnt - 1 > prev:
			print(prev - 1)
			break
		else:
			prev = (val + cnt - 1) // cnt + cnt - 1
			cnt += 1


t = int(input())
for _ in range(t):
	lst = [0] * 63245
	n = int(input())
	lst[0] = 1
	maximum = 1
	maximum_cnt = 1
	(re, cnt) = (1, 0)
	while re < n:
		cnt += 1
		if n - re >= maximum:
			if maximum_cnt >= 2:
				maximum += 1
				lst[cnt] = lst[cnt - 1] + maximum
				maximum_cnt = 1
			else:
				lst[cnt] = lst[cnt - 1] + maximum
				maximum_cnt += 1
		else:
			lst[cnt] = lst[cnt - 1] + (n - re)
		re = lst[cnt]
	print(cnt)


import math
for t in range(int(input())):
	n = int(input())
	x = int(math.sqrt(n))
	p = n // x
	if n % x != 0:
		p += 1
	print(x - 1 + p - 1)


from math import sqrt
for t in range(int(input())):
	n = int(input())
	if n == 1:
		print(0)
		continue
	s = sqrt(n)
	if s == int(s):
		print((int(s) - 1) * 2)
		continue
	s = int(s)
	if n <= s * (s + 1):
		k = 1
	else:
		k = 2
	s -= 1
	print(s * 2 + k)


import math
from collections import deque
from collections import defaultdict
t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	a = math.floor(n ** 0.5)
	b = math.ceil(n / a)
	ans = a + b - 2
	print(ans)


from math import ceil, floor
t = int(input())
for i in range(t):
	n = int(input())
	k = n - 1
	j = floor(n ** 0.5)
	move = n
	while j <= n and move >= k:
		move = k
		k = j - 1 + ceil(n / j) - 1
		j += 1
	move = min(move, k)
	print(move)


import math
for _ in range(int(input())):
	n = int(input())
	a = [1]
	if n == 1:
		print(0)
	else:
		k = int(math.sqrt(n))
		c = k - 1
		p = 0
		if (n - k) % k == 0:
			p = (n - k) // k
			print(c + p)
		else:
			p = (n - k) // k
			print(c + p + 1)


for _ in range(int(input())):
	n = int(input())
	if n == 1:
		print(0)
	elif n == 2:
		print(1)
	else:
		x = int(n ** (1 / 2))
		if x * x == n:
			print(x + x - 2)
		elif x * (x + 1) >= n:
			print(x + x - 1)
		else:
			print(x + x)


import math
for i in range(int(input())):
	n = int(input())
	print(int(math.sqrt(n)) + math.ceil(n / int(math.sqrt(n))) - 2)


import math
t = int(input())
for _ in range(t):
	n = int(input())
	s = math.floor(math.sqrt(n))
	if s ** 2 == n:
		print(2 * s - 2)
	elif s * (s + 1) < n:
		print(2 * s)
	else:
		print(2 * s - 1)


import sys
from math import ceil
t = int(input().strip())
for a0 in range(t):
	n = int(input())
	print(ceil((n ** 0.5 - 1) * 2))


T = int(input())

def get_incr(s):
	sqr = int(s ** 0.5)
	for incr in range(0, 3):
		if (sqr + incr) * sqr >= s:
			return incr
for _ in range(0, T):
	s = int(input())
	sqr = int(s ** 0.5)
	incr = get_incr(s)
	print(sqr - 1 + sqr + incr - 1)


import sys, math
input = lambda : sys.stdin.readline().rstrip()

def gcd(n, f):
	if n == 0 or f == 0:
		return max(n, f)
	if n > f:
		return gcd(n % f, f)
	else:
		return gcd(f % n, n)

def division_with_remainder_up(pp, ppp):
	return (pp + ppp - 1) // ppp
for _ in range(int(input())):
	n = int(input())
	if n == 1:
		print(0)
		continue
	else:
		b = int(n ** 0.5)
		ans = b - 1
		ans += division_with_remainder_up(n, b) - 1
		print(ans)


import math
t = int(input())
for i in range(t):
	n = int(input())
	s = math.sqrt(n)
	if math.ceil(s) == math.floor(s):
		s = int(s)
		print(2 * (s - 1))
	else:
		s = math.floor(s)
		if n <= s * (s + 1):
			print(2 * s - 1)
		else:
			print(2 * s)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def IF(c, t, f):
	return t if c else f

def YES(c):
	return IF(c, 'YES', 'NO')

def Yes(c):
	return IF(c, 'Yes', 'No')

def main():
	t = I()
	rr = []
	for _ in range(t):
		n = I()

		def f(i):
			r = i - 1
			r += (n - 1) // i
			return r
		s = int(n ** 0.5)
		r = inf
		for i in range(max(1, s - 2), s + 3):
			t = f(i)
			if r > t:
				r = t
		rr.append(r)
	return JA(rr, '\n')
print(main())


import sys
import math
from collections import defaultdict, Counter
input = sys.stdin.readline

def print(x):
	sys.stdout.write(str(x) + '\n')
t = int(input())
for i in range(t):
	n = int(input())
	s = 1
	ans = 0
	cur = 1
	while s < n:
		s += cur
		cur += 1
		ans += 1
		if s >= n:
			break
		s += cur
		ans += 1
	print(ans)


from math import *
t = int(input())
for _ in range(t):
	n = int(input())
	c = 0
	m = n + 1
	if n < 100:
		for i in range(1, int(sqrt(n)) + 2):
			a = ceil(n / i) - 1 + c
			if a < m:
				m = a
			c = c + 1
	else:
		c = int(sqrt(n)) - 2
		for i in range(int(sqrt(n)) - 1, int(sqrt(n) + 2)):
			a = ceil(n / i) - 1 + c
			if a < m:
				m = a
			c = c + 1
	print(m)


import math
t = int(input())
for k in range(t):
	n = int(input())
	kol = n
	for i in range(1, int(math.sqrt(n)) + 2):
		kol = min(kol, (n + i - 1) // i + i - 2)
	print(kol)


import math as m
t = int(input())
for t0 in range(t):
	n = int(input())
	a = m.ceil(n ** 0.5)
	b = m.ceil(n / a)
	print(a + b - 2)


import math
for i in range(int(input())):
	n = int(input())
	if n == 1:
		print(0)
		continue
	x = math.floor(math.sqrt(n))
	y = n / x
	z = math.ceil(x + y - 2)
	print(z)


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
from collections import Counter
inp = lambda : int(input())
strng = lambda : input().strip()
jn = lambda x, l: x.join(map(str, l))
strl = lambda : list(input().strip())
mul = lambda : map(int, input().strip().split())
mulf = lambda : map(float, input().strip().split())
seq = lambda : list(map(int, input().strip().split()))
ceil = lambda x: int(x) if x == int(x) else int(x) + 1
ceildiv = lambda x, d: x // d if x % d == 0 else x // d + 1
flush = lambda : stdout.flush()
stdstr = lambda : stdin.readline()
stdint = lambda : int(stdin.readline())
stdpr = lambda x: stdout.write(str(x))
stdarr = lambda : map(int, stdstr().split())
mod = 1000000007
for _ in range(stdint()):
	n = stdint()
	f = ceil(sqrt(n))
	rem = n - f
	d = ceil(rem / f)
	print(f + d - 1)


import math
testcase = int(input())
for test in range(testcase):
	num = int(input())
	root = int(math.sqrt(num))
	times = num // root
	if num % root != 0:
		times += 1
	res = times + root - 2
	print(res)


import math
import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	ans = 1145141919810
	for i in range(int(math.sqrt(n)), n + 1):
		cnt = i - 2 + int(math.ceil(n / i))
		if ans >= cnt:
			ans = cnt
		else:
			break
	print(ans)


import math
t = int(input())

def ceildiv(a, b):
	return (a + b - 1) // b
for _ in range(t):
	n = int(input())
	if n == 1:
		print(0)
		continue
	num = math.floor(math.sqrt(n))
	ans = math.floor(ceildiv(n, num)) + num - 2
	print(ans)


import math
t = int(input())
for _ in range(t):
	n = int(input())
	b = math.ceil(math.sqrt(n))
	a = int(b) + int(n / b)
	a -= 2
	if int(b) * int(n / b) < n:
		print(a + 1)
	else:
		print(a)


import math
t = int(input())
for _ in range(t):
	n = int(input())
	if n == 1:
		print(0)
	else:
		d = math.ceil(math.sqrt(n))
		mini = 9999999999999999999
		for i in range(d - 1, d + 1):
			x = math.ceil(n / i)
			if i - 2 + x < mini:
				mini = i - 2 + x
		print(mini)


def do():
	q = int(input())
	import math
	for _ in range(q):
		n = int(input())
		i = 1
		minval = 900000000000000
		minind = -1
		for i in range(1, int(math.sqrt(n)) + 3):
			cnt = i - 1 + (n - i + i - 1) // i
			minval = min(minval, cnt)
		print(minval)
do()


import math
T = int(input())
while T:
	n = int(input())
	f = int(n ** 0.5)
	c = math.ceil(n / f)
	print(f + c - 2)
	T -= 1


for _ in range(int(input())):
	n = int(input())
	k = int(pow(n, 0.5))
	if k * k >= n:
		print(2 * (k - 1))
		continue
	if k * (k + 1) >= n:
		print(k + k - 1)
		continue
	if (k + 1) * (k + 1) >= n:
		print(2 * k)


for _ in range(int(input())):
	n = int(input())
	(b, x) = (n ** 0.5, 10 ** 9)
	for i in range(1, int(b) + 1):
		x = min(x, i - 1 + (n - 1) // i)
	print(x)


import math

def function(n):
	total = 0
	min1 = 10 ** 10
	if n == 1:
		return 0
	if n == 2:
		return 1
	if n == 3:
		return 2
	for i in range(math.floor(math.sqrt(n)), 0, -1):
		c = i - 1 + (math.ceil(n / i) - 1)
		if c < min1:
			min1 = c
			total += 1
		if c > min1:
			return min1
			break
function(3)
t = int(input())
for k1 in range(t):
	n = int(input())
	print(function(n))


import math

def f(n):
	if n == 1:
		return 0
	if n == 2:
		return 1
	sq = math.floor((n - 1) ** 0.5)
	sq2 = math.ceil((n - 1) ** 0.5)
	steps = sq - 1
	steps += math.ceil((n - sq) / sq)
	steps2 = sq2 - 1
	steps2 += math.ceil((n - sq2) / sq2)
	steps = min([steps, steps2])
	return steps
t = int(input())
for _ in range(t):
	n = int(input())
	print(f(n))


l = []
for _ in range(int(input())):
	n = int(input())
	t = int(n ** (1 / 2))
	if t * t >= n:
		l.append(t + t - 2)
	elif t * (t + 1) == n:
		l.append(t + t - 1)
	elif t * (t + 1) > n:
		l.append(t + t - 1)
	else:
		l.append(t + t)
for i in l:
	print(i)


for _ in range(int(input())):
	n = int(input())
	print(int(n ** 0.5) - 1 + (n + int(n ** 0.5) - 1) // int(n ** 0.5) - 1)


import math as m
n = int(input())
for t in range(n):
	a = int(input())
	b = m.ceil(2 * a ** (1 / 2))
	print(b - 2)


import math
for _ in range(int(input())):
	n = int(input())
	if n == 1:
		print(0)
	else:
		p1 = int(math.sqrt(n - 1))
		p2 = p1 + 1
		ans = min(p2 + (n - 1) // p2 - 1, p1 + (n - 1) // p1 - 1)
		print(ans)


from math import floor
test_cases = int(input())
for _ in range(test_cases):
	n = int(input())
	ans = 1000000000.0
	x = 1
	while x * x <= n:
		ans = min(ans, x - 1 + (n - x + x - 1) / x)
		x += 1
	print(floor(ans))


from math import sqrt, ceil, floor
t = int(input())
while t:
	n = int(input())
	b = int(sqrt(n) * 2) - 1
	if sqrt(n) == int(sqrt(n)):
		b -= 1
	print(b)
	t -= 1


from sys import stdout, stdin
from io import IOBase, BytesIO
from os import read, write, fstat
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = read(self._fd, max(fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self, size: int=...):
		while self.newlines == 0:
			b = read(self._fd, max(fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
(stdin, stdout) = (IOWrapper(stdin), IOWrapper(stdout))
input = lambda : stdin.readline().rstrip('\r\n')
import math
t = int(input())
for _ in range(t):
	n = int(input())
	s = math.ceil(math.sqrt(n))
	if s * (s - 1) >= n:
		print(2 * s - 3)
	else:
		print(2 * s - 2)


import math
import sys

class Graph:

	def __init__(self, Nodes, is_directed=False):
		self.nodes = Nodes
		self.adj_list = {}
		self.is_directed = is_directed
		for node in self.nodes:
			self.adj_list[node] = []

	def add_edge(self, u, v):
		self.adj_list[u].append(v)
		if self.is_directed == False:
			self.adj_list[v].append(u)

	def print_graph(self):
		for node in self.nodes:
			print(node, '->', self.adj_list[node])

	def degree_node(self, node):
		return len(self.adj_list[node])

	def dfsUTIL(self, v, visited, parents=[]):
		visited[v] = True
		for i in self.adj_list[v]:
			if visited[i] == False:
				self.dfsUTIL(i, visited, parents)
				parents.append(i)

	def dfs(self, v):
		visited = [False] * (max(self.adj_list) + 1)
		parents = [v]
		self.dfsUTIL(v, visited, parents)
		return len(parents)

def dict_sort(ans):
	ans = sorted(ans.items(), reverse=True, key=lambda kv: kv[1])

def is_prime(n):
	if n == 1:
		return 0
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			return False
	return True

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def seive_primes(n):
	flag = [0] * (n + 10)
	flag[1] = flag[0] = 1
	i = 2
	while i * i <= n + 1:
		if flag[i] == 0:
			j = i * i
			while j <= n + 1:
				flag[j] = 1
				j += i
		i += 1
	return flag

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	return a * b // gcd(a, b)

def alphabates():
	return 'abcdefghijklmnopqrstuvwxyz'

def binary_search(ls, n, flag):
	low = 0
	hi = n - 1
	while low <= hi:
		mid = (low + hi) // 2
		if ls[mid] == flag:
			return mid
		elif ls[mid] > flag:
			hi = mid - 1
		else:
			low = mid + 1
	return -1

def qdrt(x, a, b, c):
	return a * x * x + b * x + c

def inp():
	ls = list(map(int, input().split()))
	return ls

def mult_inp():
	return map(int, input().split())
t = int(input())
for _ in range(t):
	n = int(input())
	if n == 1:
		print(0)
		continue
	ans = math.ceil(n ** 0.5) - 1
	baki = n - ans - 1
	print(ans + math.ceil(baki / (ans + 1)))


from sys import stdin
tt = int(stdin.readline())
for loop in range(tt):
	n = int(stdin.readline())
	x = int(n ** 0.5)
	ans = float('inf')
	for i in range(x - 10, x + 10):
		for j in range(x - 10, x + 10):
			if i > 0 and j > 0 and (i * j >= n):
				ans = min(ans, i + j - 2)
	print(ans)


import os, sys
from collections import defaultdict
from io import BytesIO, IOBase
from math import sqrt, ceil, floor
mod = 998244353

def t(a):
	if a > mod:
		a -= mod
	return a

def main():
	for i in range(int(input())):
		n = int(input())
		if n <= 1:
			print(0)
		else:
			x = ceil(sqrt(n))
			print(min(x - 1 + ceil(n / x), x - 2 + ceil(n / (x - 1))) - 1)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


from math import sqrt
for _ in range(int(input())):
	n = int(input())
	k = int(sqrt(n))
	ans = k - 1
	ans += (n - 1) // k
	print(ans)


import math

def moves(n):
	sq = math.sqrt(n)
	if int(sq) != sq:
		sq = int(sq) + 1
	i = sq
	while i * sq >= n:
		i -= 1
	i += 1
	return int(i + sq - 2)
T = int(input())
for t in range(T):
	ans = moves(int(input()))
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	ans = 10 ** 18
	for i in range(1, 63245):
		ans = min(ans, i - 1 + (n + i - 1) // i - 1)
	print(ans)


for _ in range(int(input())):
	n = int(input())
	ans = float('inf')
	k = int(n ** 0.5)
	if k * k != n:
		k += 1
	k -= 1
	k += (n - 1) // (k + 1)
	print(k)


t = int(input())
for i in range(t):
	s = int(input())
	q = int(s ** 0.5)
	if q == s ** 0.5:
		print(2 * q - 2)
	elif s ** 0.5 - q >= 0.5:
		print(2 * q)
	else:
		print(2 * q - 1)


import sys
sys.setrecursionlimit(10 ** 5)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')

def II():
	return int(sys.stdin.buffer.readline())

def MI():
	return map(int, sys.stdin.buffer.readline().split())

def LI():
	return list(map(int, sys.stdin.buffer.readline().split()))

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def BI():
	return sys.stdin.buffer.readline()[:-1]

def SI():
	return sys.stdin.buffer.readline()[:-1].decode()
for _ in range(II()):
	s = II()
	for a in range(int(s ** 0.5) - 1, s + 1):
		if a ** 2 >= s:
			ans = a - 1 + (s + a - 1) // a - 1
			print(ans)
			break


from math import *
t = int(input())
for i in range(t):
	n = int(input())
	a = 100000000000
	i = 1
	for i in range(1, int(sqrt(n) + 1)):
		a = min(a, i - 1 + (n - i + i - 1) // i)
	print(a)


from math import ceil
for _ in range(int(input())):
	n = int(input())
	if n == 1:
		print(0)
	else:
		t1 = ceil(n ** 0.5)
		kp = ceil(n / t1)
		print(t1 + kp - 2)


import sys

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

def ria():
	return list(map(int, sys.stdin.readline().split()))

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')

def ceil(x, y=1):
	return int(-(-x // y))
import math
from collections import defaultdict
for _ in range(ri()):
	n = ri()
	x = math.ceil(pow(n, 0.5))
	cnt = x - 1
	n -= x
	cnt = cnt + math.ceil(n / x)
	wi(cnt)


from math import ceil
t = int(input())
for _ in range(t):
	x = int(input())
	print(ceil(2 * (-1 + x ** 0.5)))


import math
test = int(input())
for t in range(0, test):
	n = int(input())
	sq = int(math.sqrt(n))
	print(sq + math.ceil(n / sq) - 2)


from sys import stdin, stdout
input = stdin.buffer.readline
for _ in range(int(input())):
	n = int(input())
	mn = 10 ** 10
	for k in range(max(0, int(n ** 0.5) - 100), int(n ** 0.5) + 100):
		mn = min(mn, k + (n + k) // (k + 1) - 1)
	print(mn)


import math
import sys
from sys import stdin, stdout
ipi = lambda : int(stdin.readline())
ipil = lambda : map(int, stdin.readline().split())
ipf = lambda : float(stdin.readline())
ipfl = lambda : map(float, stdin.readline().split())
ips = lambda : stdin.readline().rstrip()
out = lambda x: stdout.write(str(x) + '\n')
outl = lambda x: print(*x)
T = ipi()
for _ in range(T):
	n = ipi()
	tmp = int(math.sqrt(n))
	ans = tmp - 1
	if tmp * tmp >= n:
		ans += tmp - 1
	elif tmp * (tmp + 1) >= n:
		ans += tmp
	else:
		ans += tmp + 1
	print(ans)


import math

def solve(k):
	if k == 1:
		return 0
	if k == 2:
		return 1
	if k == 3:
		return 2
	minVal = 498387378783478347
	val = 0
	kth = 0
	last = 498387378783478347
	p = round(math.sqrt(k))
	col = []
	for i in range(p - 50, p + 50):
		if k - p * i < 0:
			break
		if minVal > abs(k - p * i):
			minVal = abs(k - p * i)
			kth = i
	if minVal != 0:
		return p - 1 + (kth - 1) + 1
	return p - 1 + (kth - 1)
m = int(input())
for i in range(m):
	k = int(input())
	print(solve(k))


for _ in range(int(input())):
	n = int(input())
	p = int(n ** 0.5)
	ans = p * 2 - 2
	if n != p ** 2:
		ans += 1
	if n > p * (p + 1):
		ans += 1
	print(ans)


from math import *
for _ in range(int(input())):
	n = int(input())
	if n > 100:
		k = ceil(sqrt(n)) - 10
	else:
		k = 1
	if n > 1:
		for i in range(k, ceil(sqrt(n)) + 1):
			a = ceil(n / i)
			if a <= i:
				print(a + i - 2)
				break
	else:
		print(0)


from math import sqrt

def ans(n):
	if n == 1:
		return 0
	z = int(sqrt(n))
	if z * z == n:
		return 2 * z - 2
	elif z * (z + 1) >= n:
		return 2 * z - 1
	else:
		return 2 * z
m = int(input())
for j in range(m):
	n = int(input())
	print(ans(n))


import math
for _ in range(int(input())):
	n = int(input())
	low_bound = int(math.sqrt(n))
	upper_bound = int(math.sqrt(n)) + 1 if math.sqrt(n) > int(math.sqrt(n)) else int(math.sqrt(n))
	num_of_operations = -1
	round_low = 1 if n % low_bound != 0 else 0
	round_upper = 1 if n % upper_bound != 0 else 0
	num_of_operations += min(n // low_bound + round_low + low_bound, n // upper_bound + round_upper + upper_bound)
	print(num_of_operations - 1)


t = int(input())
for t1 in range(t):
	n = int(input())
	if n == 1:
		print(0)
	else:
		root = int(n ** 0.5)
		temp = int(n / root)
		if n % root == 0:
			print(-2 + root + temp)
		else:
			print(-1 + root + temp)


import math
t = int(input())
for _ in range(t):
	n = int(input())
	if n == 1:
		print(0)
	else:
		op = math.sqrt(n)
		op1 = int(op)
		if op1 * op1 == n:
			print(int(op * 2) - 2)
		else:
			print(int(op * 2 - 1))


import math
for i in range(int(input())):
	n = int(input())
	if n == 1:
		print(0)
	elif n == 2:
		print(1)
	else:
		x = int(math.sqrt(n))
		y = n / x
		ans = x + int(y) - 2
		if int(y) != y:
			ans += 1
		print(ans)


import math

def solve(i):

	def calc(steps):
		return (1 + math.floor(steps / 2)) * math.ceil(steps / 2)

	def bin_search(start, end):
		if end == start + 1:
			print(start)
			return
		mid = (start + end) // 2
		if calc(mid) >= i:
			bin_search(start, mid)
		else:
			bin_search(mid, end)
	bin_search(0, int(100000.0))
num_tests = int(input())
for _ in range(num_tests):
	solve(int(input()))


for _ in range(int(input())):
	n = int(input())
	if n == 1:
		print(0)
	elif n == 2:
		print(1)
	else:
		r = int(n ** 0.5)
		if n % r == 0:
			ans = n // r - 1 + (r - 1)
		else:
			ans = n // r + (r - 1)
		print(ans)


import cmath
for _ in range(int(input())):
	n = int(input())
	a = 1
	b = 1
	c = n
	d = b ** 2 - 4 * a * c
	sol = cmath.sqrt(d)
	print(int(float(str(sol)[:-1])) - 1)


for _ in range(int(input())):
	n = int(input())
	if n == 1:
		print(0)
	else:
		ans = n ** (1 / 2)
		if ans == int(ans):
			su = ans - 1
			op = n / ans
			op -= 1
			print(int(op + su))
		else:
			op = int(ans)
			sl = op
			op += 0.5
			if ans >= op:
				print(int(sl + sl))
			else:
				print(int(sl + sl - 1))


import math
for _ in range(int(input())):
	n = int(input())
	s = int(math.sqrt(n))
	if n % s == 0:
		print(s - 2 + n // s)
	else:
		print(s - 1 + n // s)


import math

def func(x):
	ans = math.inf
	i = 1
	while i * i <= x:
		if x % i == 0:
			ans = min(ans, i - 1 + (x // i - 1))
		else:
			ans = min(ans, i - 1 + int(x // i))
		i += 1
	return ans
t = int(input())
for i in range(t):
	n = int(input())
	print(func(n))


import sys
input = sys.stdin.buffer.readline
from bisect import bisect_left as bl
sumFromMoves = []
moves = 0
while True:
	nums = (moves + 2) // 2
	cnts = (moves + 3) // 2
	total = nums * cnts
	sumFromMoves.append(total)
	if total > 10 ** 9:
		break
	moves += 1
t = int(input())
for _ in range(t):
	n = int(input())
	ans = bl(sumFromMoves, n)
	print(ans)


import sys, os.path
from collections import *
from copy import *
import math
mod = 10 ** 9 + 7
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
for t in range(int(input())):
	n = int(input())
	cur = math.ceil(math.sqrt(n))
	summ = cur
	moves = cur - 1
	while summ < n:
		summ += cur
		moves += 1
	print(moves)


for t in range(int(input())):
	n = int(input())
	if n == 1:
		print(0)
		continue
	import math
	x = pow(n, 1 / 2)
	if x % 1 == 0:
		print(int(x + x - 2))
	else:
		x = int(x)
		y = x + 1
		if x * y >= n:
			print(int(x + y) - 2)
		else:
			x += 1
			print(int(x + y) - 2)


def bs(arr, num):
	(si, ei) = (0, len(arr) - 1)
	while si <= ei:
		mi = (si + ei) // 2
		if arr[mi][2] < num:
			si = mi + 1
		elif arr[mi][2] > num:
			ei = mi - 1
		else:
			return mi
	return si

def g(n):
	i = 0
	while i * i <= n:
		yield (i, i, i * i)
		yield (i, i + 1, i * (i + 1))
		i += 1
l = list(g(1000100000))
for t in range(int(input())):
	n = int(input())
	i = bs(l, n)
	print(l[i][0] + l[i][1] - 2)


for _ in range(int(input())):
	a = int(input())
	ans = 100000
	for i in range(40000):
		t = i + a // (i + 1)
		if a % (i + 1) == 0:
			t = t - 1
		if t < ans:
			ans = t
	if a == 1:
		ans = 0
	print(ans)


from sys import stdin, stdout
from math import ceil
for _ in range(int(input())):
	n = int(input())
	x = ceil(n ** 0.5)
	y = ceil(n / x)
	print(x - 1 + y - 1)


pre = [0 for i in range(63245)]
pre[0] = 1
pre[1] = 2
curr = 2
move = 2
ans = 1
c = 0
n = 10 ** 9
while curr < n:
	curr += move
	ans += 1
	c += 1
	if c % 2 == 0:
		move += 1
	pre[ans] = curr
for _ in range(int(input())):
	n = int(input())
	l = 0
	r = 63244
	while l < r:
		m = (l + r) // 2
		if pre[m] >= n:
			r = m
		else:
			l = m + 1
	print(l)


for i in range(int(input())):
	su = int(input())
	su -= 1
	a = [1]
	mov = 0
	if su == 0:
		print(0)
	else:
		while su != 0:
			a.append(a[-1])
			su -= a[-1]
			mov += 1
			if su <= 0:
				print(mov)
				break
			else:
				a[-1] += 1
				su -= a[-1]
				mov += 1
				if su <= 0:
					print(mov)
					break


(T,) = list(map(int, input().split()))
for _ in range(T):
	(N,) = list(map(int, input().split()))
	c = int(N ** 0.5)
	R = 10 ** 18
	for i in range(max(1, c - 10), c + 10):
		R = min(R, i - -N // i - 2)
	print(R)


import math
for _ in range(int(input())):
	n = int(input())
	x = math.floor(n ** 0.5)
	print(x - 1 + math.ceil((n - x) / x))


x = int(input())
for i in range(x):
	a = int(input())
	ans = 2 * (a ** 0.5 - 1)
	if ans != ans // 1:
		print(int(ans // 1 + 1))
	else:
		print(int(ans // 1))


from math import ceil, sqrt

def solve(n):
	i = 1
	p = int(sqrt(n))
	ans = p - 1 + ceil(n / p) - 1
	return ans
for _ in range(int(input())):
	n = int(input())
	print(solve(n))


import math
for _ in range(int(input())):
	n = int(input())
	x = int(math.sqrt(n))
	ans = n // x
	if n % x != 0:
		ans += 1
	x -= 1
	ans += x
	print(ans - 1)


import sys
read = sys.stdin.readline
import math

def solution(n):
	num = int(math.sqrt(n))
	cnt = num - 1 + n // num - 1
	if n % num != 0:
		cnt += 1
	return cnt
t = int(read())
for _ in range(t):
	print(solution(int(read())))


t = int(input())
for i in range(t):
	n = int(input())
	ans = int(2 * n ** 0.5) - 1
	if int(n ** 0.5) - n ** 0.5 == 0:
		print(ans - 1)
	else:
		print(ans)


import sys
import math
infile = sys.stdin
next(infile)
for line in infile:
	n = int(line)
	if n == 1:
		print(0)
	else:
		rtn = int(math.sqrt(n))
		moves = n
		if rtn > 5:
			for i in range(rtn - 5, rtn + 5):
				if n % i == 0:
					moves = min(moves, i - 1 + (n // i - 1))
				else:
					moves = min(moves, i - 1 + n // i)
		else:
			for i in range(1, rtn + 1):
				if n % i == 0:
					moves = min(moves, i - 1 + (n // i - 1))
				else:
					moves = min(moves, i - 1 + n // i)
		print(moves)


import math
teststring = '5\n1\n5\n42\n1337\n1000000000\n'
online = __file__ != '/home/jhli/py/674/Problem_C.py'
(true, false) = (True, False)
if True:

	def spitout():
		for c in teststring.splitlines():
			yield c
	_ito = spitout()
	if not online:

		def input():
			return next(_ito)

	def build_enum(*a):
		built = dict()
		for (i, c) in enumerate(a):
			built[c] = i
		return lambda x: built[x]
T = int(input())
for ti in range(1, T + 1):
	n = int(input())
	k = math.floor(math.sqrt(n - 1)) - 1
	if (k + 1) * (k + 2) >= n:
		print(str(2 * k + 1))
	else:
		print(str(2 * k + 2))


import math
for _ in range(int(input())):
	n = int(input())
	minmoves = float('inf')
	i = 1
	while i * i <= n:
		minmoves = min(minmoves, i - 1 + (n + i - 1) // i - 1)
		i += 1
	print(minmoves)


from math import floor
t = int(input())
for _ in range(t):
	n = int(input())
	if n == 1:
		print(0)
	elif n == 2:
		print(1)
	else:
		print(floor((4 * (n - 1) + 1) ** 0.5 - 1))


import math
t = int(input())
for _ in range(t):
	n = int(input())
	ans = n
	i = 1
	L = max(1, int(math.sqrt(n) - 10))
	R = int(math.sqrt(n) + 10)
	for i in range(L, R + 1):
		ans = min(ans, i - 1 + (n - 1) // i)
	print(ans)


import sys
input = lambda : sys.stdin.readline().strip()
for _ in range(int(input())):
	n = int(input())
	print(min((i - 1 + (n + i - 1) // i - 1 for i in range(1, int(n ** 0.5) + 10))))


import math
for _ in range(int(input())):
	n = int(input())
	mn = float('inf')
	pat = 0
	mx = 1
	while mx * mx <= n:
		if n % mx == 0:
			val = mx - 1 + n // mx
			if val < mn:
				mn = val
				pat = mx
		else:
			val = mx + n // mx
			if val < mn:
				mn = val
				pat = mx
		mx += 1
	print(mn - 1)


import math
for cases in range(int(input())):
	num = int(input())
	root = math.ceil(num ** 0.5)
	ans = root + math.ceil(num / root) - 2
	print(ans)


from math import *
import threading
import sys

def fact(x):
	if x == 0:
		return 1
	else:
		return x * fact(x - 1)

def lower_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] >= num:
			answer = middle
			end = middle - 1
		else:
			start = middle + 1
	return answer

def upper_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] <= num:
			answer = middle
			start = middle + 1
		else:
			end = middle - 1
	return answer

def abs(x):
	return x if x >= 0 else -x

def binary_search(li, val, lb, ub):
	ans = -1
	while lb <= ub:
		mid = (lb + ub) // 2
		if li[mid] > val:
			ub = mid - 1
		elif val > li[mid]:
			lb = mid + 1
		else:
			ans = mid
			break
	return ans

def kadane(x):
	sum_so_far = 0
	current_sum = 0
	for i in x:
		current_sum += i
		if current_sum < 0:
			current_sum = 0
		else:
			sum_so_far = max(sum_so_far, current_sum)
	return sum_so_far

def pref(li):
	pref_sum = [0]
	for i in li:
		pref_sum.append(pref_sum[-1] + i)
	return pref_sum

def graph(n, m):
	adj = dict()
	for i in range(1, n + 1):
		adj.setdefault(i, 0)
	for i in range(m):
		(a, b) = map(int, input().split())
		adj[a] += 1
		adj[b] += 1
	return adj

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	li = []
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for p in range(2, len(prime)):
		if prime[p]:
			li.append(p)
	return li
INF = 1000000000.0
primes = SieveOfEratosthenes(1300000)

def fn(n):
	i = 2
	res = n - 1
	val = 0
	for i in range(int(sqrt(n)) + 1, 1, -1):
		val = i - 1 + int(ceil((n - i) / i))
		if val <= res:
			res = val
		else:
			break
	return res
for _ in range(int(input())):
	n = int(input())
	res = fn(n)
	print(res)


import math
for _ in range(int(input())):
	n = int(input())
	c = int(n ** 0.5)
	print(c - 2 + math.ceil(n / c))


import math

def solve():
	n = int(input())
	k = int(math.sqrt(n))
	if k * k == n:
		print(k * 2 - 2)
	elif k * (k + 1) >= n:
		print(k * 2 - 1)
	else:
		print(k * 2)
for i in range(int(input())):
	solve()


import math
for _ in 'A' * int(input()):
	n = int(input())
	m = math.ceil(math.sqrt(n))
	k = math.floor(math.sqrt(n))
	print(m + math.ceil(n / m) - 2)


import sys
import math
x = int(sys.stdin.readline().rstrip())
for xx in range(x):
	n = int(sys.stdin.readline().rstrip())
	n -= 1
	count = 0
	choices = [1]
	maxnum = 1
	while n > 0:
		n -= maxnum
		count += 1
		if n > maxnum:
			maxnum += 1
			n -= maxnum
			count += 1
	print(count)


import math
n = int(input())
for i in range(n):
	a = int(input())
	x = int(math.sqrt(a))
	print(math.ceil(x - 1 + (a - x) / x))


import math
for _ in range(int(input())):
	n = int(input())
	if n == 1:
		print(0)
	else:
		k = int(n ** 0.5)
		if k * k < n:
			k += 1
		ans = k - 1
		if k * (k - 1) >= n:
			ans += k - 2
		else:
			ans += k - 1
		print(ans)


import math
for i in range(int(input())):
	n = int(input())
	if n == 1:
		print(0)
		continue
	a = math.ceil(math.sqrt(n))
	print(math.ceil((n - a) / a) + a - 1)


def ceil_div(divisible, divisor):
	return (divisible + divisor - 1) // divisor
t = int(input())
for _ in range(t):
	n = int(input())
	result = 0
	s = 1
	while ceil_div(n, s + 1) < ceil_div(n, s):
		result += 1
		s += 1
	result += ceil_div(n, s)
	print(result - 1)


def process():
	n = int(input())
	if n == 1:
		print(0)
		return 0
	moves = 100000000
	p = int(n ** 0.5) + 1
	for i in range(p - 10, p + 10):
		if i > 0 and i <= n:
			m = i - 2 + n / i
			if m % 1 != 0:
				m += 1
			moves = min(moves, m)
	print(int(moves))

def main():
	for i in range(int(input())):
		process()
main()


from math import *
for t in range(int(input())):
	n = int(input())
	print(ceil(n / ceil(sqrt(n))) + ceil(sqrt(n)) - 2)


import sys
import bisect
input = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
t = int(input())
ns = map(int, read().split())
ls = []
for i in range(2, 70000):
	j = i >> 1
	k = i - j
	ls.append(j * k)
ans = []
for n in ns:
	ans.append(bisect.bisect_left(ls, n))
print('\n'.join(map(str, ans)))


l = int(input())

def round_up(y):
	return int(y) + int(y % 1 != 0)

def turns(x):
	n = int(x ** 0.5 - 1)
	if n != 0:
		m = round_up((x - 1 - n) / (n + 1))
	else:
		m = x - 1
	return n + m
for i in range(l):
	x = int(input())
	print(turns(x))


from math import sqrt, ceil
for _ in range(int(input())):
	n = int(input())
	n1 = int(sqrt(n))
	n2 = ceil(n / n1)
	print(n1 + n2 - 2)


import sys
from collections import deque
from math import ceil, sqrt, gcd, factorial
from bisect import bisect_right, bisect_left
mod = 1000000007
INF = 10 ** 18
NINF = -INF

def I():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST():
	return list(map(int, input(), split()))

def modi(x):
	return pow(x, mod - 2, mod)

def lcm(x, y):
	return x * y // gcd(x, y)

def write(l):
	for i in l:
		print(i, end=' ')
	print()
for _ in range(I()):
	n = I()
	x = int(sqrt(n))
	if x * x == n:
		print(2 * x - 2)
		continue
	if n - x * x > x:
		print(2 * x)
		continue
	print(2 * x - 1)


import math
t = input()
t = int(t)
for i in range(t):
	n = input()
	n = int(n)
	x = math.sqrt(n)
	if x.is_integer():
		x = int(x)
	else:
		x = int(x) + 1
	if n % x != 0:
		count = n // x
	else:
		count = n // x - 1
	count = count + x - 1
	print(count)


from math import sqrt, ceil
t = int(input())
for i in range(t):
	n = int(input())
	root = ceil(sqrt(n))
	increments = root - 1
	copies = ceil(n / root) - 1
	print(increments + copies)


def solve(t):
	for i in range(t):
		n = int(input())
		i = 1
		ans = 0
		while i <= n:
			k = ans // 2 + 1
			i += k
			ans += 1
		print(ans - 1)
t = int(input())
solve(t)


from sys import stdin, stdout, maxsize
tup = lambda : map(int, stdin.readline().split())
I = lambda : int(stdin.readline())
lint = lambda : [int(x) for x in stdin.readline().split()]
stpr = lambda x: stdout.write(f'{x}' + '\n')
star = lambda x: print(' '.join(map(str, x)))
from math import ceil
for _ in range(I()):
	n = I()
	if n == 1:
		print(0)
	else:
		print(ceil((n ** 0.5 - 1) * 2))


for _ in range(int(input())):
	n = int(input())
	x = int(pow(n, 0.5))
	ans = x - 1 + (n + x - 1) // x - 1
	print(ans)


from math import *
for _ in range(int(input())):
	n = int(input())
	x = floor(sqrt(n))
	y = ceil(n / x) - 1
	print(x + y - 1)


import math
t = int(input())
for j in range(t):
	n = int(input())
	ans = 1000000000.0
	for i in range(1, int(math.sqrt(n)) + 1):
		ans = min(ans, i - 1 + (n - i + (i - 1)) // i)
	print(ans)


for _ in range(int(input())):
	n = int(input())
	mn = 10 ** 18
	for i in range(1, n + 1):
		moves = i + (n + i - 1) // i
		if moves > mn:
			break
		mn = min(mn, moves)
	print(mn - 2)


from math import ceil
n = input()
for x in range(int(n)):
	num = int(input())
	mosse = ceil(num ** 0.5 - 0.5) - 1
	mosse *= 2
	if ceil(num ** 0.5 - 0.5) * ceil(num ** 0.5 - 0.5) < int(num):
		mosse += 1
	print(mosse)


import math
for _ in range(int(input())):
	n = int(input())
	sq = int(math.sqrt(n))
	d = n // sq
	ans = sq - 1 + d - 1
	if n % sq:
		ans += 1
	print(ans)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import math
from collections import Counter, defaultdict, deque

def int1():
	return int(input())

def map1():
	return map(int, input().split())

def list1():
	return list(map(int, input().split()))
mod = pow(10, 9) + 7

def solve():
	n = int1()
	if n == 1:
		print(0)
	else:
		v = math.sqrt(n)
		v = math.floor(v)
		v1 = v - 1 + math.ceil(n / v) - 1
		print(v1)
for _ in range(int(input())):
	solve()


import math

def increase_and_copy():
	test_cases = int(input())
	for t in range(test_cases):
		n = [int(x) for x in input().split(' ')]
		k = int(math.sqrt(n[0]))
		if n[0] == 1:
			moves = 0
		elif n[0] == 2:
			moves = 1
		elif n[0] == 3:
			moves = 2
		else:
			k2 = int(n[0] / k)
			moves = k - 1 + k2 - 1
			if k2 * k != n[0]:
				moves += 1
		print(moves)
increase_and_copy()


INF = 10 ** 15
for _ in range(int(input())):
	n = int(input())
	res = INF
	for i in range(n):
		x = i + 1 + (n - i - 2) // (1 + i)
		if x <= res:
			res = x
		else:
			break
	print(res)


def hi(N):
	if N == 1:
		return 0
	if N == 2:
		return 1
	if N == 3 or N == 4:
		return 2
	p = int(N ** 0.5)
	n = p - 1
	k = p - 1
	yy = N - p ** 2
	dd = yy // p
	rr = yy % p
	k += dd
	if rr == 0:
		return n + k
	else:
		return n + k + 1
t = int(input())
b = []
for i in range(t):
	p = int(input())
	b.append(hi(p))
for i in range(len(b)):
	print(b[i])


for nt in range(int(input())):
	n = int(input())
	if n == 1:
		print(0)
		continue
	ans = 10 ** 18
	for i in range(max(1, int(n ** 0.5) - 5), min(n, int(n ** 0.5) + 5)):
		ans = min(ans, (n - 1) // i + (i - 1))
	print(ans)


import math
for _ in range(int(input())):
	n = int(input())
	res = math.ceil((math.sqrt(n) - 1) * 2)
	print(res)


import sys
from copy import *
from bisect import *
from math import gcd, ceil, sqrt
from itertools import permutations as prm, product

def eprint(*args):
	print(*args, file=sys.stderr)
zz = 1
if zz:
	input = sys.stdin.readline
else:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('all.txt', 'w')
di = [[-1, 0], [1, 0], [0, 1], [0, -1]]

def string(s):
	return ''.join(s)

def fori(n):
	return [fi() for i in range(n)]

def inc(d, c, x=1):
	d[c] = d[c] + x if c in d else x

def bo(i):
	return ord(i) - ord('A')

def li():
	return [int(xx) for xx in input().split()]

def fli():
	return [float(x) for x in input().split()]

def comp(a, b):
	if a > b:
		return 2
	return 2 if a == b else 0

def gi():
	return [xx for xx in input().split()]

def fi():
	return int(input())

def pro(a):
	return reduce(lambda a, b: a * b, a)

def swap(a, i, j):
	(a[i], a[j]) = (a[j], a[i])

def si():
	return list(input().rstrip())

def mi():
	return map(int, input().split())

def gh():
	sys.stdout.flush()

def isvalid(i, j):
	return 0 <= i < n and 0 <= j < m and (a[i][j] != '.')

def bo(i):
	return ord(i) - ord('a')

def graph(n, m):
	for i in range(m):
		(x, y) = mi()
		a[x].append(y)
		a[y].append(x)
t = fi()

def cil(n, m):
	return n // m + int(n % m > 0)
while t > 0:
	t -= 1
	n = fi()
	move = it = 0
	c = 1
	maxi = 1
	l = 1
	r = 10 ** 10
	ans = 10 ** 12

	def can(p):
		return p - 1 + cil(n - p, p)
	l = int(sqrt(n)) - 10
	r = l + 20
	for i in range(l, r + 1):
		if i <= 0:
			continue
		ans = min(ans, can(i))
	print(ans)


import sys
import itertools

def get_line():
	return list(map(int, sys.stdin.readline().strip().split()))

def in1():
	return int(input())
for _ in range(in1()):
	n = in1()
	t1 = 100000000000
	i = 2
	if n == 1:
		print(0)
	else:
		while True:
			t2 = n // i
			if n % i == 0:
				t2 -= 1
			t2 += i - 1
			i += 1
			if t2 > t1:
				break
			t1 = t2
		print(t1)


from __future__ import division, print_function
from io import BytesIO, IOBase
import os, sys, math, heapq, copy
from collections import defaultdict, deque, Counter
from bisect import bisect_left, bisect_right
from functools import cmp_to_key
from itertools import permutations, combinations, combinations_with_replacement
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
mod = 1000000007

def get_int():
	return int(sys.stdin.readline().strip())

def get_str():
	return sys.stdin.readline().strip()

def get_float():
	return float(sys.stdin.readline().strip())

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_strs():
	return map(str, sys.stdin.readline().strip().split())

def get_floats():
	return map(float, sys.stdin.readline().strip().split())

def list_ints():
	return list(map(int, sys.stdin.readline().strip().split()))

def list_strs():
	return list(map(str, sys.stdin.readline().strip().split()))

def list_floats():
	return list(map(float, sys.stdin.readline().strip().split()))
t = get_int()
for _ in range(t):
	n = get_int()
	x = math.floor(math.sqrt(n))
	y = math.ceil((n - x) / x)
	ans = x - 1 + y
	print(ans)


from math import sqrt
N = int(input())
for _ in range(N):
	n = int(input())
	a = (0, 1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9)
	srt = sqrt(n)
	d = n - int(srt) * int(srt)
	if n < len(a):
		print(a[n - 1])
		continue
	if d == 0:
		print(int(srt) * 2 - 2)
	elif d % int(srt) == 0:
		print(int(srt) * 2 - 2 + d // int(srt))
	else:
		print(int(srt) * 2 - 1 + d // int(srt))


from math import ceil
for tc in range(int(input())):
	n = int(input())
	s = ceil(n ** 0.5)
	t = n ** 0.5 // 1
	sans = ceil(n / s) + s
	tans = ceil(n / t) + t
	print(max(min(sans, tans) - 2, 0))


from sys import stdin

def get_ints():
	return list(map(int, stdin.readline().strip().split()))
for _ in range(int(input())):
	n = int(input())
	low = 0
	high = n // 2 + 1
	if n == 1:
		print(0)
		continue
	while low + 1 < high:
		mid = (low + high) // 2
		mid += 2
		if mid // 2 * (mid - mid // 2) >= n:
			high = mid - 2
		else:
			low = mid - 2
	print(high)


t = int(input())
for _ in range(t):
	n = int(input())
	root2 = n ** 0.5
	if int(root2) == root2:
		print(int(root2 * 2 - 2))
	else:
		flr = root2 // 1
		if flr * (flr + 1) >= n:
			print(int(flr * 2 - 1))
		else:
			print(int(flr * 2))


import math
for i in range(int(input())):
	n = int(input())
	s = n ** 0.5
	x = math.floor(2 * s)
	if n == 1:
		print(0)
	elif s == math.floor(s):
		print(int(s) * 2 - 2)
	else:
		print(x - 1)


import math
t = int(input())
for _ in range(t):
	n = int(input())
	x = int(n ** 0.5)
	print(x + math.ceil(n / x) - 2)


import math
t = int(input())
for _ in range(t):
	n = int(input())
	first = math.floor(math.sqrt(n))
	second = n // first
	rem = n - first * second
	if rem > 0:
		rem = 1
	res = first + second + rem - 2
	print(res)


def solve(n):
	return min((i - 1 + (n // i - 1) + (0 if n % i == 0 else 1) for i in range(1, 32000)))
for _ in range(int(input())):
	n = int(input())
	print(solve(n))


from collections import *
from itertools import *
from bisect import *

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

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

def main():
	t = inp()
	for _ in range(t):
		n = inp()
		if n == 1:
			print(0)
		elif n == 2:
			print(1)
		else:
			k = 1
			counts = float('inf')
			old = counts
			new = counts
			while n / k >= 1:
				old = counts
				counts = min(counts, n // k + (n % k != 0) - 1 + k - 1)
				t = k + 1
				new = n // t + (n % t != 0) - 1 + t - 1
				if counts <= old and counts < new:
					break
				k += 1
			print(counts)
main()


from sys import stdin, stdout

def find(N):
	if N == 1:
		return 0
	a = 1
	r = float('inf')
	while True:
		a += 1
		k = N // a + bool(N % a)
		if a + k - 2 > r:
			return r
		r = a + k - 2

def main():
	for _ in range(int(stdin.readline())):
		N = int(stdin.readline())
		print(find(N))
main()


for _ in range(int(input())):
	n = int(input())
	if n == 1:
		print(0)
		continue
	elif n == 2:
		print(1)
		continue
	ans = n
	for i in range(2, n):
		temp = i - 1 + int((n + i - 1) / i) - 1
		if temp > ans:
			break
		else:
			ans = temp
	print(ans)


from math import sqrt
for _ in range(int(input())):
	n = int(input())
	diff = (sqrt(n) + 0.999999999999) // 1
	print(round(diff - 1 + sqrt(n) - 1))


import math

def increaseAndCpy(n):
	nroot = math.floor(math.sqrt(n))
	if nroot * nroot >= n:
		print(2 * nroot - 2)
		return
	elif (nroot + 1) * nroot >= n:
		print(2 * nroot - 1)
		return
	else:
		print(2 * nroot)
		return
tc = int(input())
for _ in range(0, tc):
	n = int(input())
	increaseAndCpy(n)


import math
t = int(input())
while t:
	t -= 1
	n = int(input())
	if n == 1:
		print(0)
	elif n == 2:
		print(1)
	else:
		mx = n
		c = 0
		for i in range(max(2, round(math.sqrt(n)) - 2), round(math.sqrt(n)) + 1):
			tem = i - 1 + math.ceil((n - i) / i)
			mx = min(tem, mx)
		print(mx)


import math as mt
t = int(input())
for i in range(0, t):
	n = int(input())
	if n == 1:
		ans = 0
	else:
		x = mt.sqrt(n)
		y = mt.ceil(x)
		x = int(y)
		z = (x - 1) * (x - 1)
		z1 = (x - 1) * x
		if z >= n:
			inc = x - 1 - 1
			copy = x - 1 - 1
			ans = inc + copy
		elif z1 >= n:
			inc = x - 1 - 1
			copy = x - 1
			ans = inc + copy
		else:
			inc = x - 1
			copy = x - 1
			ans = inc + copy
	print(ans)


for t in range(int(input())):
	n = int(input())
	k = int(pow(n, 0.5))
	if n == 1:
		print(0)
	elif k * k == n:
		print(2 * k - 2)
	else:
		t = n // (k + 1)
		n = n % (k + 1)
		res = k + t - 1
		if n != 0:
			print(res + 1)
		else:
			print(res)


for _ in range(int(input())):
	n = int(input())
	if n == 1:
		print(0)
	elif n == 2:
		print(1)
	elif n == 3:
		print(2)
	else:
		a = int(n ** 0.5)
		c = 2 * (a - 1) - 1
		if n == a ** 2:
			c += 1
		elif n <= a ** 2 + a:
			c += 2
		else:
			c += 3
		print(c)


for t in range(int(input())):
	n = int(input())
	count = 0
	(mini, a) = (99999, 0)
	for i in range(1, 63245):
		a = n // i
		if n % i != 0:
			a += 1
		mini = min(mini, a - 1 + i - 1)
	print(mini)


from functools import lru_cache
from sys import stdin, stdout
import sys
from math import *
input = stdin.readline
for __ in range(int(input())):
	n = int(input())
	s = int(sqrt(n))
	print((n + s - 1) // s + s - 2)


import math

def div(a, b):
	if b == 0:
		return 100000
	if a % b == 0:
		return a // b
	return a // b + 1
t = int(input())
for _ in range(t):
	n = int(input())
	a = int(math.sqrt(n))
	b = min(a + div(n, a), a - 1 + div(n, a - 1), a + 1 + div(n, a + 1)) - 2
	print(b)


def ceil(a, b):
	return -(-a // b)

def main():
	n = int(input())
	(x, ans) = (1, 10 ** 9)
	while x * x <= n:
		ans = min(ans, x - 1 + ceil(n - x, x))
		x += 1
	print(ans)
for _ in range(int(input())):
	main()


import math

def solve(n):
	ans = math.inf
	if n == 1 or n == 2 or n == 3:
		print(n - 1)
		return
	for i in range(1, int(math.sqrt(n)) + 1):
		if n % i == 0:
			ans = min(ans, n // i + i - 1)
		else:
			ans = min(ans, n // i + 1 + i - 1)
	print(ans - 1)
for _ in range(int(input())):
	n = int(input())
	solve(n)


from math import *

def fun(n):
	sq = floor(sqrt(n))
	out = (sq - 1) * 2
	n = n - sq * sq
	if n == 0:
		return out
	elif n > sq:
		return out + 2
	else:
		return out + 1
t = int(input())
while t:
	t = t - 1
	n = int(input())
	print(fun(n))


t = int(input())
for _ in range(t):
	n = int(input())
	prev = n
	nex = n // 2 + (1 if n % 2 != 0 else 0)
	i = 3
	while prev != nex:
		(prev, nex) = (nex, n // i + (1 if n % i != 0 else 0))
		i += 1
	print(n // prev + (1 if n % prev != 0 else 0) + prev - 2)


import sys
import math
from collections import defaultdict, Counter
input = sys.stdin.readline

def print(x):
	sys.stdout.write(str(x) + '\n')
t = int(input())
for i in range(t):
	n = int(input())
	ans = n - 1
	for j in range(max(1, int(math.sqrt(n)) - 5), min(n + 1, int(math.sqrt(n)) + 5)):
		cur = j - 1 + int(math.ceil((n - j) / j))
		ans = min(ans, cur)
	print(ans)


import math
for _ in range(int(input())):
	n = int(input())
	if n == 1:
		print(0)
		continue
	res = float('inf')
	x = int(math.sqrt(n))
	for i in range(-5, 6):
		if x - i > 0:
			y = n / (x - i + 1) - 1
			if y != int(y):
				y += 1
			res = min(res, x - i + int(y))
	print(res)


def solve(n):
	(a, b) = (int(n ** 0.5), int(n ** 0.5))
	x = 0
	if n == 1:
		return 0
	while True:
		if a * b >= n:
			break
		elif x % 2 == 0:
			a += 1
			x = 1
		else:
			b += 1
			x = 0
	return a - 1 + (b - 1)
t = int(input())
from math import floor
for _ in range(t):
	n = int(input())
	print(solve(n))


import sys
r = sys.stdin.readline
for _ in range(int(r())):
	N = int(r())
	if N == int(N ** 0.5) ** 2:
		print((int(N ** 0.5) - 1) * 2)
	elif N <= int(N ** 0.5) * int(N ** 0.5 + 1):
		print(int(N ** 0.5) * 2 - 1)
	else:
		print(int(N ** 0.5) * 2)


from math import ceil, sqrt
t = int(input())
for _ in range(t):
	n = int(input())
	mini = 10 ** 18
	ans = -1
	for i in range(int(sqrt(n)), int(sqrt(n)) + 100):
		mini = min(i - 1 + ceil(n / i) - 1, mini)
		if mini == i - 1 + ceil(n / i) - 1:
			ans = i
	print(mini)


from math import *
from sys import *
input = stdin.readline
for _ in range(int(input())):
	n = int(input())
	if n == 1:
		stdout.write(str(0) + '\n')
		continue
	sq = int(sqrt(n))
	d = n // sq
	n = n - d * sq
	cn = d + sq - 1
	if n % sq == 0:
		cn -= 1
	stdout.write(str(cn) + '\n')


import math
n = int(input())
for i in range(n):
	N = int(input())
	ans = math.ceil(2 * N ** 0.5) - 2
	print(ans)


t = int(input())
for _ in range(t):
	ans = 0
	n = int(input())
	srt = int(n ** 0.5)
	ans += srt - 1
	q = n // srt - 1
	ans += q
	r = n % srt
	if r > 0:
		ans += 1
	print(ans)


for _ in range(int(input())):
	a = int(input())
	b = int(-(-a ** 0.5 // 1))
	if a == 1:
		print(0)
	elif a % b == 0:
		print(b - 2 + a // b)
	else:
		print(b - 1 + a // b)


import sys
from math import sqrt
from math import ceil
fast_reader = sys.stdin.readline
fast_writer = sys.stdout.write

def input():
	return fast_reader().strip()
for _ in range(int(input())):
	n = int(input())
	ans = n
	a = ceil(sqrt(n))
	for i in range(max(1, a + 1 - 1000), a + 1):
		temp = i - 1 + ceil(n / i - 1)
		ans = min(ans, temp)
	print(ans)


import math
t = int(input())
for _ in range(t):
	n = int(input())
	if n == 1:
		print(0)
	else:
		root = math.floor(math.sqrt(n))
		ans = root - 1
		print(ans + math.ceil((n - root) / root))


for t in range(int(input())):
	n = int(input())
	d = 1
	ans = 0
	if n == 1:
		mn = 0
	else:
		mn = 1000000000000000
	for i in range(35000):
		d += 1
		ans += 1
		k = (n - d) // d + int(bool((n - d) % d))
		if d + k - 1 < mn:
			mn = d + k - 1
		elif d + k - 1 > mn:
			break
	print(mn)


from sys import stdin, stdout, setrecursionlimit
t = 1
t = int(stdin.readline())
for _ in range(t):
	n = int(stdin.readline())
	if n == 1:
		print(0)
		continue
	if n == 2:
		print(1)
		continue
	ans = 10 ** 7
	for i in range(min(n + 1, 63255)):
		j = i + 1
		tmp = (n - j + j - 1) // j
		ans = min(ans, tmp + i)
	print(ans)


test = int(input())
for _ in range(test):
	n = int(input())
	ans = 2 ** 31 - 1
	i = 1
	while i * i <= n:
		c = i - 1
		d = n // i
		if n % i:
			d += 1
		c += d - 1
		ans = min(ans, c)
		i += 1
	print(ans)


import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce

def input():
	return sys.stdin.readline().strip()

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

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

def ZIP(n):
	return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
t = int(input())
for i in range(t):
	n = int(input())
	a = int(sqrt(n))
	if a * a >= n:
		print(2 * a - 2)
	elif (a + 1) * a >= n:
		print(2 * a - 1)
	else:
		print(2 * a)


import math
T = int(input())
for t in range(T):
	n = int(input())
	root = math.sqrt(n)
	floored_root = math.floor(root)
	difference = root - floored_root
	if n - floored_root ** 2 > floored_root:
		floored_root += 1
	to_num = floored_root - 1
	print(to_num + (floored_root - 1) + (1 if floored_root ** 2 < n else 0))


def f(q):
	x = q // 2
	k = q - x
	return (x + 1) * (k + 1)
for _ in range(int(input())):
	n = int(input())
	l = -1
	r = 10 ** 9
	while l + 1 != r:
		m = l + (r - l) // 2
		if f(m) < n:
			l = m
		else:
			r = m
	print(r)


import math
t = int(input(''))
for _ in range(t):
	n = int(input(''))
	x = math.sqrt(n)
	if x == int(x):
		x = int(x)
		sol = n // x - 1
		sol += x - 1
		print(sol)
	else:
		x = int(x) + 1
		sol = n // x
		if sol * x == n:
			sol -= 1
		sol += x - 1
		print(sol)


def INT():
	return int(input())

def lis():
	return [int(x) for x in input().split()]
t = int(input())
for i in range(t):
	n = INT()
	a = n ** (1 / 2) // 1
	b = (n - 1) // a
	print(int(a - 1 + b))


import sys
readline = sys.stdin.readline
T = int(readline())
Ans = [None] * T
for qu in range(T):
	N = int(readline())
	ok = 0
	ng = 100000
	while ng - ok > 1:
		med = (ok + ng) // 2
		if med * med <= N:
			ok = med
		else:
			ng = med
	ans = ok + ok - 2
	k = N - ok * ok
	if k:
		if k <= ok:
			ans += 1
		else:
			ans += 2
	Ans[qu] = ans
print('\n'.join(map(str, Ans)))


import math
for i in range(int(input())):
	n = int(input())
	temp = int(math.sqrt(n))
	if n > temp * (temp + 1):
		print(temp * 2)
	elif n > temp * temp:
		print(temp * 2 - 1)
	else:
		print(temp * 2 - 2)


from sys import stdin, stdout
from math import gcd, sqrt, factorial, pi, inf
from collections import deque, defaultdict
input = stdin.readline
R = lambda : map(int, input().split())
I = lambda : int(input())
S = lambda : input().rstrip('\n')
L = lambda : list(R())
P = lambda x: stdout.write(x)
lcm = lambda x, y: x * y // gcd(x, y)
hg = lambda x, y: (y + x - 1) // x * x
pw = lambda x: 1 if x == 1 else 1 + pw(x // 2)
chk = lambda x: chk(x // 2) if not x % 2 else True if x == 1 else False
sm = lambda x: (x ** 2 + x) // 2
N = 10 ** 9 + 7
for _ in range(I()):
	n = I()
	x = int(sqrt(n))
	y = (n + x - 1) // x
	print(x + y - 2)


import math
import sys

class Read:

	@staticmethod
	def string():
		return input()

	@staticmethod
	def int():
		return int(input())

	@staticmethod
	def list(sep=' '):
		return input().split(sep)

	@staticmethod
	def list_int(sep=' '):
		return list(map(int, input().split(sep)))

def solve():
	n = Read.int()
	v = math.ceil(math.sqrt(n))
	m = math.ceil(n / v)
	print(v - 1 + m - 1)
query_count = Read.int()
while query_count:
	query_count -= 1
	solve()


for _ in range(int(input())):
	n = int(input())
	answer = 1000000000.0
	for i in range(int(n ** (1 / 2)), 0, -1):
		if n % i == 0:
			if answer >= i + n // i - 2:
				answer = i + n // i - 2
			else:
				break
		elif answer >= i + n // i - 1:
			answer = i + n // i - 1
		else:
			break
	print(answer)


t = int(input())
for i in range(t):
	n = int(input())
	print(int(n ** 0.5) + ((n - 1) // int(n ** 0.5) + 1) - 2)


t = int(input())
import math
for i in range(t):
	n = int(input())
	temp = int(math.sqrt(n))
	temp2 = math.ceil((n - temp) / temp)
	res = temp - 1 + temp2
	print(res)


import sys
import math
tests = int(input())
for a in range(tests):
	n = int(input())
	res = float('inf')
	if n > 100:
		low = math.floor(math.sqrt(n)) - 5
	else:
		low = 1
	for i in range(low, math.floor(math.sqrt(n)) + 1):
		res = min(i - 1 + math.ceil((n - i) / i), res)
	print(int(res))


import sys, bisect
input = sys.stdin.readline
A = [1, 2]
val = 2
i = 2
while val <= 10 ** 9:
	val = val + i
	A.append(val)
	val = val + i
	A.append(val)
	i = i + 1
T = int(input())
for _ in range(T):
	n = int(input())
	v = bisect.bisect_left(A, n)
	print(v)


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
import copy
import time
starttime = time.time()
mod = int(pow(10, 9) + 7)
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def L():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
try:
	sys.stdin = open('input.txt', 'r')
except:
	pass

def pmat(A):
	for ele in A:
		print(*ele, end='\n')

def seive():
	prime = [1 for i in range(10 ** 6 + 1)]
	prime[0] = 0
	prime[1] = 0
	for i in range(10 ** 6 + 1):
		if prime[i]:
			for j in range(2 * i, 10 ** 6 + 1, i):
				prime[j] = 0
	return prime
for _ in range(L()[0]):
	n = L()[0]
	ans = n
	x = int(n ** 0.5)
	for i in range(x, x + 3):
		count = i - 1 + n // i - 1 + int(n % i != 0)
		if count < ans:
			ans = count
	print(ans)
endtime = time.time()


import math
for _ in range(int(input())):
	n = int(input())
	sq = int(math.sqrt(n))
	ans = n - 1
	for i in range(max(1, sq - 5), sq + 6):
		a = i - 1 + math.ceil((n - i) / i)
		ans = min(a, ans)
	print(ans)


for _ in range(int(input())):
	n = int(input())
	if n == 1:
		print(0)
	else:
		x = pow(n, 0.5)
		if x.is_integer():
			print(int(2 * x - 2))
		else:
			print(int(2 * x - 1))


import math

def solution():
	n = int(input())
	for i in range(0, n):
		num = int(input())
		sqrt = math.sqrt(num)
		pairs = [[math.floor(sqrt), math.floor(sqrt)], [math.floor(sqrt), math.ceil(sqrt)], [math.ceil(sqrt), math.ceil(sqrt)]]
		min_ = math.inf
		for pair in pairs:
			if pair[0] * pair[1] >= num:
				min_ = min(min_, pair[0] + pair[1] - 2)
		print(min_)
solution()


import os
import sys
from io import BytesIO, IOBase
import math

def main1():
	for _ in range(int(input())):
		(n, x) = map(int, input().split())
		if n <= 2:
			print(1)
		else:
			n -= 2
			print(1 + math.ceil(n / x))

def main2():
	for _ in range(int(input())):
		(n, m) = map(int, input().split())
		flag = 0
		for i in range(n):
			mat = []
			for j in range(2):
				mat.append(list(map(int, input().split())))
			if mat[0][1] == mat[1][0]:
				flag = 1
		if m % 2 or flag == 0:
			print('NO')
		else:
			print('YES')

def main3():
	for _ in range(int(input())):
		n = int(input())
		ans = float('inf')
		for i in range(1, math.floor(math.sqrt(n)) + 1):
			ans = min(ans, i - 1 + (n - i + i - 1) // i)
		print(ans)

def main4():
	n = int(input())
	a = list(map(int, input().split()))
	ls = [0] * n
	ls[0] = a[0]
	for i in range(1, n):
		ls[i] = ls[i - 1] + a[i]
	ans = 0
	d = dict()
	d[0] = 0
	d[ls[0]] = 0
	prev_pos = 0
	for i in range(1, n):
		if ls[i] in d:
			pos = d[ls[i]] + 1
			if pos >= prev_pos:
				prev_pos = i
				ans += 1
		d[ls[i]] = i
	print(ans)

def main5():
	n = int(input())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	max_win = min(a[0], b[1]) + min(a[1], b[2]) + min(a[2], b[0])
	min_win = max(0, a[0] - b[0] - b[2]) + max(0, a[1] - b[1] - b[0]) + max(0, a[2] - b[2] - b[1])
	print(min_win, max_win)

def main6():
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main3()


import math
T = int(input())
for _ in range(T):
	n = int(input())
	div = 0
	if n in [1, 0]:
		print(0)
	elif n == 2:
		print(1)
	elif n == 3:
		print(2)
	else:
		sq = n ** 0.5
		number_1 = int(sq)
		number_2 = int(sq) + 1
		number_3 = int(sq) - 1
		moves_1 = number_1 - 1 + (math.ceil(n / number_1) - 1)
		moves_2 = number_2 - 1 + (math.ceil(n / number_2) - 1)
		moves_3 = number_3 - 1 + (math.ceil(n / number_3) - 1)
		print(min(moves_1, moves_2, moves_3))


import sys
import math
from collections import defaultdict, deque
input = sys.stdin.readline

def inar():
	return [int(el) for el in input().split()]

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		sm = 10 ** 18
		take = int(math.sqrt(n))
		for i in range(-5, 6, 1):
			lol = take - i
			if lol > n or lol < 1:
				continue
			sm = min(sm, lol - 1 + math.ceil((n - lol) / lol))
		print(sm)
main()


rw = int(input())
for wewq in range(rw):
	n = int(input())
	f = n
	for i in range(int(n ** 0.5) + 1):
		if i + (n + i) // (i + 1) < f:
			f = i + (n + i) // (i + 1)
	print(f - 1)


t = int(input())
import math
while t > 0:
	t -= 1
	n = int(input())
	if n == 1:
		print(0)
	else:
		x = n ** 0.5 - 1
		y = n ** 0.5 - 1
		print(math.ceil(y + x))


from math import sqrt, floor
for _ in range(int(input())):
	n = int(input())
	p = int(sqrt(n))
	ans = 0
	ans += p - 1
	ans += n // p - 1
	if n % p != 0:
		ans += 1
	print(ans)


import sys
from math import sqrt, ceil

def solve(n):
	tot = 0
	if n > 1:
		s = int(sqrt(n))
		max_rep = int(ceil(n / s))
		tot = s - 1 + max_rep - 1
	return tot
IN = [x.strip() for x in sys.stdin.readlines()]
T = int(IN[0])
for ti in range(T):
	n = int(IN[ti + 1])
	res = solve(n)
	print(res)


from enum import *
from copy import *
from sys import *
from collections import *
from itertools import *
from functools import *
from math import *

def l2i(fr=None):
	return map_type_to_fr(int, fr)[0]

def i2i(fr=None):
	return l2i(fr)

def dbg(*args):
	print(*args, file=stderr)

def dbv(var_name):
	print(f'{var_name} = {eval(var_name)}', file=stderr)

def map_type_to_fr(t, fr):
	global GETLINE_OFFSET
	if fr is None:
		if RUNNING_ON_MY_PC:
			fr = TEST_INP[GETLINE_OFFSET].split()
			GETLINE_OFFSET += 1
		else:
			fr = input().split()
	return list(map(t, fr))

def mis(fr=None):
	return map_type_to_fr(int, fr)

def mbs(fr=None):
	return map_type_to_fr(bool, fr)

def gs(fr=None):
	return map_type_to_fr(str, fr)[0]

def en(col):
	return enumerate(col)

def rn(*args):
	return range(*args)
import os
import sysconfig
RUNNING_ON_MY_PC = os.name == 'nt' and platform == 'win32' and (sysconfig.get_platform() == 'win-amd64')
GETLINE_OFFSET = 0
TEST_INP = '10\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n'.split('\n')

def my_r(x):
	c = ceil(x)
	if c - x > 0.5:
		return floor(x)
	return c
for _ in range(i2i()):
	n = i2i()
	if n < 4:
		print(n - 1)
		continue
	s = floor(sqrt(n))
	dbv('s')
	q = ceil(n / s)
	dbv('q')
	ans = s - 1 + q - 1
	print(ans)


import math
x1 = int(input())
for i in range(x1):
	n = int(input())
	m = 0
	c = math.sqrt(n)
	d = int(math.sqrt(n))
	if n == 1:
		print(0)
	elif n == 2:
		print(1)
	elif n == 3 or n == 4:
		print(2)
	elif c - d > 0.5:
		print(d * 2)
	elif c - d == 0:
		print(d * 2 - 2)
	else:
		print(d * 2 - 1)


from sys import stdin
nii = lambda : map(int, stdin.readline().split())
lnii = lambda : list(map(int, stdin.readline().split()))
t = int(input())
for tt in range(t):
	n = int(input())
	ok = n
	ng = -1
	while abs(ok - ng) > 1:
		m = (ok + ng) // 2
		num = 1 + m // 2
		num *= m - m // 2 + 1
		if num >= n:
			ok = m
		else:
			ng = m
	print(ok)


import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
import collections
from itertools import permutations
from collections import defaultdict
from collections import deque
import threading
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD
for _ in range(int(input())):
	n = int(input())
	r = 0
	d1 = math.ceil(math.sqrt(n))
	d2 = int(math.sqrt(n))
	r = min(d1 - 2 + math.ceil(n / d1), d2 - 2 + math.ceil(n / d2))
	print(r)


from math import sqrt
for tc in range(int(input())):
	n = int(input())
	ans = float('inf')
	for i in range(1, int(sqrt(n)) + 1):
		ans = min(ans, i - 1 + (n - i + i - 1) // i)
	print(ans)


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	if n == 1:
		print(0)
	else:
		i = 1
		while 1:
			if i * i < n and n <= (i + 1) * (i + 1):
				k = n - i * i
				break
			i += 1
		count = 2 * (i - 1)
		if i >= k:
			count += 1
		else:
			count += 2
		print(count)


for _ in range(int(input())):
	N = int(input())
	if int(N ** (1 / 2)) ** 2 == N:
		print(int(N ** (1 / 2)) + int(N ** (1 / 2)) - 2)
	elif N ** (1 / 2) < float(int(N ** (1 / 2)) + 0.5):
		print(int(N ** (1 / 2)) + int(N ** (1 / 2)) - 1)
	else:
		print(int(N ** (1 / 2)) + int(N ** (1 / 2)))


a = int(input())
for i in range(a):
	b = int(input())
	c = b ** 0.5 // 1
	if c ** 2 != b:
		c += 1
	if b > c * (c - 1):
		print(int(c * 2 - 2))
	else:
		print(int(c * 2 - 3))


t = int(input())
for i in range(t):
	number = int(input())
	if number == 1:
		print(0)
	else:
		comp = number - 1
		for u in range(max(int(number ** 0.5) - 5, 1), int(number ** 0.5) + 2):
			x = u
			change = x + (number - x) // x
			if (number - x) / x % 1 == 0:
				change -= 1
			if change < comp:
				comp = change
		print(comp)


import sys
from array import array
import typing as Tp

def input():
	return sys.stdin.buffer.readline().decode('utf-8')

def main():
	t = int(input())
	ans = [0] * t
	for ti in range(t):
		n = int(input())
		x = 10 ** 9
		if n == 1:
			continue
		for i in range(2, 40000):
			x = min(x, i + (n + i - 1) // i - 2)
		ans[ti] = x
	sys.stdout.buffer.write(('\n'.join(map(str, ans)) + '\n').encode('utf-8'))
main()


for _ in range(int(input())):
	n = int(input())
	ans = 1000000000000
	c = 0
	d = {}
	if n in d:
		print(d[n])
		continue
	for i in range(1, min(1000000, n + 1)):
		c += 1
		cur = i - 1 + n // i - 1 + int(n % i != 0)
		if cur <= ans:
			ans = cur
		else:
			break
	print(ans)
	d[n] = ans


from math import sqrt
import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__
t = int(input())
ans = {1: 0, 2: 1, 3: 2, 4: 2}
for _ in range(t):
	n = int(input())
	if n < 5:
		print(ans[n])
		continue
	root = 1
	while root * root < n:
		root += 1
	print(root - 1 + (n + root - 1) // root - 1)


from sys import stdin, stdout
import math
from collections import deque
input = stdin.readline

def print(*args, end='\n'):
	s = []
	for i in args:
		s.append(str(i) + ' ')
	s = ''.join(s)
	stdout.write(s + end)

def solve():
	n = int(input())
	if n == 1:
		print(0)
		return
	div = int(n ** 0.5)
	ans = div - 1 + n // div - 1
	if n % div:
		ans += 1
	print(ans)
tt = 1
tt = int(input())
for __ in range(tt):
	solve()


t = int(input())
list1 = []
for i in range(t):
	n = int(input())
	d = n - 1
	a = int(n ** 0.5)
	if n % a == 0:
		c = int(n / a + a - 2)
		list1.append(c)
	else:
		c = int(min(n / a + a - 1, n / (a + 1) + a))
		list1.append(c)
for i in list1:
	print(i)


import math
t = int(input())
for j in range(t):
	n = int(input())
	s = int(math.sqrt(n))
	for i in range(max(s - 5, 1), s + 5):
		if i * i >= n:
			if i * (i - 1) >= n:
				print((i - 1) * 2 - 1)
				break
			else:
				print((i - 1) * 2)
				break


from sys import stdin, stdout
input = stdin.readline
print = lambda x: stdout.write(str(x) + '\n')
from math import sqrt, ceil
for _ in range(int(input())):
	n = int(input())
	s = int(sqrt(n))
	t = ceil(n / s)
	ans = s + t - 2
	print(ans)


import sys
input = sys.stdin.readline
from math import sqrt
for test in range(int(input())):
	n = int(input())
	answer = float('inf')
	t = sqrt(n)
	for i in range(-5, 6, 1):
		t2 = int(t - i)
		if t2 > n or t2 < 1:
			continue
		answer = min(answer, t2 - 2 + (n + t2 - 1) // t2)
	print(answer)


from math import ceil

def solve():
	n = int(input())
	return ceil((n ** 0.5 - 1) * 2)
for _ in range(int(input())):
	print(solve())


from sys import stdin, stdout
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	p = 1
	ans = float('inf')
	while p * p <= n:
		make_p = p - 1
		copy = n // p
		if copy * p < n:
			copy += 1
		ans = min(ans, make_p + copy - 1)
		p += 1
	print(ans)


import math as m
for i in range(int(input())):
	n = int(input())
	sq = int(m.sqrt(n))
	if n % sq == 0:
		q = n // sq
		ans = sq - 2 + q
	else:
		q = n // sq
		ans = sq - 1 + q
	print(ans)


from math import sqrt, ceil
for _ in range(int(input())):
	n = int(input())
	maxi = ceil(sqrt(n))
	if n == 1:
		print(0)
		continue
	if n == 2:
		print(1)
		continue
	print(maxi - 1 + (n // maxi if n % maxi else n // maxi - 1))


for i in range(int(input())):
	n = int(input())
	m = int(n ** 0.5)
	print(m + (n - 1) // m - 1)


import sys
import math
input = sys.stdin.readline

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

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

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
case_total = inp()
for case_no in range(case_total):
	n = inp()
	best = n
	sn = int(math.sqrt(n))
	for x in range(max(1, sn - 3), sn + 5):
		curt = x - 1 + n // x
		if n % x != 0:
			curt += 1
		if curt < best:
			best = curt
	print(best - 1)


for i in range(int(input())):
	n = int(input())
	print(min(((n + i - 1) // i + i - 2 for i in range(1, 316 * 10 ** 2 + 5))))


import math
for _ in range(int(input())):
	n = int(input())
	s = math.floor(math.sqrt(n))
	ans = float('inf')
	for i in range(-6, 6):
		t = s - i
		if t > n or t < 1:
			continue
		x = n % t
		y = t - x
		z = n // t
		if x == 0:
			temp = x + y + z - 2
		else:
			temp = x + y + z - 1
		ans = min(ans, temp)
	print(ans)


t = int(input())
from math import sqrt

def solve(n):
	moves = 0
	x = sqrt(n)
	if not x.is_integer():
		x = int(x) + 1
	moves += int(x) - 1
	rest = (n - x) / x
	moves += int(rest)
	if not rest.is_integer():
		moves += 1
	return moves
for i in range(t):
	n = int(input())
	print(solve(n))


import math
test = int(input())
for _ in range(test):
	n = int(input())
	if n == 1:
		print(0)
	else:
		count = 0
		i = math.floor(math.sqrt(n))
		count = min(math.ceil(n / i) + (i - 2), math.ceil(n / (i + 1)) + (i - 1))
		print(count)


import math
for _ in range(int(input())):
	n = int(input())
	x = math.floor(math.sqrt(n))
	if n == 1:
		print(0)
	else:
		print(x - 1 + math.ceil((n - x) / x))


import os
import sys
from io import BytesIO, IOBase
import math
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class SegmentTree1:

	def _init_(self, data, default=300006, func=lambda a, b: min(a, b)):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def _delitem_(self, idx):
		self[idx] = self._default

	def _getitem_(self, idx):
		return self.data[idx + self._size]

	def _setitem_(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def _len_(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self._getitem_(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def _repr_(self):
		return 'SegmentTree({0})'.format(self.data)
from collections import defaultdict
t = int(input())
for _ in range(t):
	n = int(input())
	v1 = math.floor(n ** 0.5)
	s = n // v1
	ans = v1 - 1 + s
	if n % v1 == 0:
		ans -= 1
	print(ans)


import sys, os
from io import BytesIO, IOBase
import collections, itertools, bisect, heapq, math, string
from decimal import *
BUFSIZE = 8192
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		if n <= 3:
			print(n - 1)
			continue
		ans = n - 1
		q = math.ceil(math.sqrt(n))
		for j in range(q - 10, q + 10):
			ans = min(ans, q - 1 + math.ceil((n - q) / q))
		print(ans)
main()


import math
t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	ans = int(math.sqrt(4 * n) - 2)
	if (ans + 2) ** 2 // 4 < n:
		ans += 1
	print(ans)


import sys
from collections import defaultdict
input = sys.stdin.readline
from math import sqrt, ceil, floor
for _ in range(int(input())):
	n = int(input())
	if n == 1:
		print(0)
		continue
	s = sqrt(n)
	if floor(s) ** 2 >= n:
		print(floor(s) - 1 + floor(s) - 1)
	elif floor(s) * ceil(s) >= n:
		print(floor(s) - 1 + floor(s))
	else:
		print(ceil(s) - 1 + ceil(s) - 1)


t = int(input())
while t:
	t += -1
	ans = 999999999999
	n = int(input())
	s = 1
	while 1:
		tmp = n // s + bool(n % s) - 1 + (s - 1)
		if tmp > ans:
			break
		ans = tmp
		s -= -1
	print(ans)


from sys import stdin, stdout, setrecursionlimit
from math import sqrt

class Tail_Recursion_Optimization:

	def __init__(self, RECURSION_LIMIT, STACK_SIZE):
		setrecursionlimit(RECURSION_LIMIT)
		threading.stack_size(STACK_SIZE)
		return None

class SOLVE:

	def solve(self):
		R = stdin.readline
		W = stdout.write
		ans = []
		for i in range(int(R())):
			n = int(R())
			num = int(sqrt(n))
			if num * num == n:
				ans.append(str(2 * num - 2))
			else:
				num += 1
				if n <= num * (num - 1):
					ans.append(str(2 * num - 3))
				else:
					ans.append(str(2 * num - 2))
		W('\n'.join(ans))
		return 0

def main():
	s = SOLVE()
	s.solve()
main()


from math import sqrt
for _ in range(int(input())):
	n = int(input())
	sqrt1 = int(sqrt(n))
	print(min(sqrt1 - 1 + (n + sqrt1 - 1) // sqrt1, sqrt1 + (n + sqrt1) // (sqrt1 + 1)) - 1)


import math
t = int(input())
for i in range(t):
	n = int(input())
	a = 0
	if n < 4:
		print(n - 1)
		continue
	temp = math.sqrt(n)
	if temp > int(temp):
		temp = int(temp) + 1
	a += temp - 1
	if n % temp == 0:
		a += n / temp - 1
	else:
		a += n / temp
	print(int(a))


from sys import stdin
import math
g = lambda : stdin.readline().strip()
gl = lambda : g().split()
gil = lambda : [int(var) for var in gl()]
inf = float('inf')
(t,) = gil()
for _ in range(t):
	(n,) = gil()
	ans = inf
	i = 1
	while i * i <= n:
		c = i - 1 + (n - i) // i + min(1, (n - i) % i)
		ans = min(ans, c)
		i += 1
	print(ans)


from math import sqrt, floor
T = int(input())
for i in range(T):
	n = int(input())
	if n < 2:
		print(0)
		continue
	m = floor(sqrt(n))
	if n % m == 0:
		print(m + int(n / m) - 2)
	else:
		print(m + int(n / m) - 1)


for _ in range(int(input())):
	n = int(input())
	ans = 2 * n ** (1 / 2) - 2
	r = int(ans)
	print(r if r == ans else r + 1)


import math
t = int(input())
for i in range(t):
	n = int(input())
	p = int(math.sqrt(n))
	a = n / p
	print(math.ceil(p + a - 2))


from math import *
n = int(input())
for i in range(n):
	m = int(input())
	print(ceil((m ** 0.5 - 1) * 2))


dsdsa = int(input())
for asdsda in range(dsdsa):
	n = int(input())
	if n == 1:
		print(0)
	else:
		q = int(n ** (1 / 2))
		cnt = q - 1
		if q * q >= n:
			cnt = cnt + q - 1
		elif q * (q + 1) >= n:
			cnt = cnt + q
		else:
			cnt = cnt + q + 1
		print(cnt)


import math
for test in range(int(input())):
	n = int(input())
	a = math.floor(n ** (1 / 2))
	b = math.floor(n ** (1 / 2))
	if a * b >= n:
		print(a + b - 2)
	elif (a + 1) * b >= n:
		print(a + b - 1)
	elif (a + 1) * (b + 1):
		print(a + b)


import math
t = int(input())
for case in range(t):
	n = int(input())
	x = math.ceil((-1 + math.sqrt(1 + 4 * n)) / 2)
	i = 0
	while x + x * x - (i + 1) * x >= n:
		i += 1
	ans = 2 * x - 1 - i
	print(ans)


from math import sqrt
for _ in range(int(input())):
	n = int(input())
	if n == 1:
		print(0)
	else:
		x = sqrt(n)
		x = int(x)
		if n % x == 0:
			print(n // x - 1 + (x - 1))
		else:
			print(n // x + (x - 1))


from sys import stdin
from math import floor, ceil, sqrt
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	s = sqrt(n)
	(f, c) = (floor(s), ceil(s))
	if f ** 2 >= n:
		print(2 * f - 2)
	elif f * c >= n:
		print(2 * f - 1)
	else:
		print(2 * c - 2)


t = int(input())
for i in range(t):
	n = int(input())
	p = 1
	r = 10 ** 10
	if n == 1:
		print(0)
		continue
	while 1:
		q = (n + p - 1) // p
		q = q - 1 + (p - 1)
		if r >= q:
			r = q
			p = p + 1
		else:
			print(r)
			break


import math

def ceil(a, b):
	return -(-a // b)

def answer(n):
	sqrtn = int(math.sqrt(n))
	breakeven = sqrtn * (sqrtn + 1)
	if n > breakeven:
		num_steps = sqrtn + 1 - 1
		num_steps += ceil(n, sqrtn + 1) - 1
	else:
		num_steps = sqrtn - 1
		num_steps += ceil(n, sqrtn) - 1
	return num_steps

def main():
	t = int(input())
	while t:
		n = int(input())
		print(answer(n))
		t -= 1
	return
main()


from math import *

def ceil(x, y):
	if x % y == 0:
		return x // y
	else:
		return x // y + 1
for _ in range(int(input())):
	n = int(input())
	val = int(sqrt(n))
	if n == 1:
		print(0)
	elif n == 2:
		print(1)
	else:
		val = ceil(n - val, val) + val - 1
		print(val)


for _ in range(int(input())):
	n = int(input())
	i = 1
	ans = 10 ** 9
	while i * i <= n:
		ans = min(ans, i - 1 + (n - i + i - 1) // i)
		i += 1
	print(ans)


from math import ceil
t = eval(input())
for i in range(t):
	n = eval(input())
	print(ceil((n ** 0.5 - 1) * 2))


import math
for _ in range(int(input())):
	n = int(input())
	a = int(n ** 0.5)
	print(a + int(n / a) + 1 * (n % a > 0) - 2)


from math import *
from collections import Counter, defaultdict
from sys import stdin, stdout
input = stdin.readline
I = lambda : int(input())
M = lambda : map(int, input().split())
LI = lambda : list(map(int, input().split()))
for _ in range(I()):
	n = I()
	ans = 10 ** 9
	for i in range(1, int(sqrt(n)) + 1):
		ans = min(ans, i - 1 + (n + (i - 1)) // i - 1)
	print(ans)


import math

def func(n):
	return int(math.floor(n / 2) * math.ceil(n / 2) + 1)
for _ in range(int(input())):
	n = int(input())
	sn = int(math.sqrt(n))
	start = max(1, sn - 5)
	end = sn + 5
	ans = math.inf
	for i in range(start, end):
		temp = i - 1 + math.ceil((n - i) / i)
		ans = min(ans, temp)
	print(ans)


for _ in range(int(input())):
	n = int(input())
	sq = int(n ** 0.5)
	print((n + sq - 1) // sq + sq - 2)


def gt():
	return list(map(int, input().split()))
(t,) = gt()
while t:
	t -= 1
	(n,) = gt()
	d = int(n ** 0.5)
	ans = d + n // d - 2 + (n % d != 0)
	print(ans)


import math
for _ in range(int(input())):
	n = int(input())
	sq = int(math.sqrt(n))
	ans = n - 1
	for i in range(sq - 2, sq + 2):
		if i > 0:
			ans = min(ans, i - 1 + math.ceil((n - i) / i))
	print(ans)


import math
t = int(input())
for i in range(t):
	n = int(input())
	ans = 0
	if n == 1:
		print(0)
		continue
	if n == int(math.sqrt(n)) ** 2:
		ans = (int(math.sqrt(n)) - 1) * 2
	else:
		x = int(math.sqrt(n))
		ans = x - 1 + math.ceil(n / x) - 1
	print(ans)


import math
for _ in range(int(input())):
	n = int(input())
	a = math.ceil(math.sqrt(n))
	print(a - 1 + math.ceil(n / a) - 1)


import os
import sys
from math import *
from collections import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
ALPHA = 'abcdefghijklmnopqrstuvwxyz/'
M = 998244353
EPS = 1e-06

def Ceil(a, b):
	return a // b + int(a % b > 0)

def value():
	return tuple(map(int, input().split()))

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

def Int():
	return int(input())

def Str():
	return input()

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

def divisors(n):
	div = set()
	for i in range(2, int(sqrt(n)) + 1):
		if n % i == 0:
			div.add(i)
			div.add(n // i)
	return div
for _ in range(Int()):
	n = Int()
	ans = n
	for i in range(1, int(sqrt(n)) + 2):
		here = i + Ceil(n, i) - 1
		ans = min(here, ans)
	print(ans - 1)


from collections import *
from functools import *
import math
import sys
inp = sys.stdin.readline
out = sys.stdout.write

def mi():
	return map(int, inp().split())

def li():
	return list(mi())

def ii():
	return int(inp())

def main():
	for _ in range(ii()):
		n = ii()
		a = 1
		if n == 1:
			print(0)
		else:
			t = math.floor(math.sqrt(n))
			if t * (n // t) == n:
				print(t + n // t - 2)
			else:
				print(t + n // t - 1)
main()


from math import ceil
for _ in range(int(input())):
	n = int(input())
	print(ceil((n ** 0.5 - 1e-06) * 2) - 2)


from math import sqrt
t = int(input())
for i in range(t):
	n = int(input())
	if n == 1:
		print(0)
	elif sqrt(n) == int(sqrt(n)):
		print(int(sqrt(n) * 2 - 2))
	else:
		print(int(sqrt(n) * 2 - 1))


import math
t = int(input())
for i in range(t):
	n = int(input())
	if n == 1:
		print('0')
		continue
	x = math.sqrt(n)
	n = math.modf(x)
	y = math.floor(x)
	min = 2 * y
	if n[0] == 0:
		min -= 2
	elif n[0] < 0.5:
		min -= 1
	print(min)


t = int(input())
for _ in range(t):
	n = int(input())
	if n == 1:
		print(0)
		continue
	if n == 2:
		print(1)
		continue
	k = int(pow(n, 0.5))
	a = n - (k + 1)
	if a % (k + 1) == 0:
		x = k + a // (k + 1)
	else:
		x = k + a // (k + 1) + 1
	k -= 1
	a = n - (k + 1)
	if a % (k + 1) == 0:
		y = k + a // (k + 1)
	else:
		y = k + a // (k + 1) + 1
	print(min(x, y))


from math import ceil
t = int(input())
for _ in range(t):
	n = int(input())
	k = int(n ** 0.5)
	print(k - 2 + ceil(n / k))


import bisect
import array
import functools
import math
T = int(input())
for Tid in range(T):
	n = int(input())
	ans = 1 << 30
	m = max(1, int(n ** 0.5) - 5)
	for i in range(10):
		ans = min(ans, m + (n + m - 1) // m - 2)
		m = m + 1
	print(ans)


from math import sqrt
for _ in range(int(input())):
	n = int(input())
	x = int(sqrt(n))
	ans = 10 ** 9
	for i in range(max(1, x - 1), x + 2):
		curr = i - 1
		curr += n // i
		if n % i != 0:
			curr += 1
		ans = min(ans, curr)
	print(ans - 1)


import math
t = int(input())
for j in range(t):
	a = int(input())
	turns = a - 1
	x = 1
	while x < math.sqrt(a) + 1:
		x += 1
		turns = min(turns, (a + x - 1) // x - 1 + (x - 1))
	print(turns)


n = int(input())
import math
for _ in range(n):
	num = int(input())
	x = math.ceil(num ** 0.5)
	if x * (x - 1) >= num:
		y = x - 1
	else:
		y = x
	print(x + y - 2)


import math
t = int(input())
floor = math.floor
ceil = math.ceil
while t:
	t -= 1
	n = int(input())
	if n == 1:
		print(0)
		continue
	root = n ** 0.5
	t1 = floor(root)
	t2 = ceil(n / t1)
	t3 = ceil(root)
	t4 = ceil(n / t3)
	ans = max(t1 + t2, t3 + t4)
	print(ans - 2)


import math
for i in [0] * int(input()):
	n = int(input())
	y = math.sqrt(n)
	a = math.floor(y)
	if a * a >= n:
		count = 2 * a - 2
	elif (a + 1) * a >= n:
		count = 2 * a - 1
	else:
		count = 2 * a
	print(count)


import math
t = int(input())
for i in range(t):
	n = int(input())
	ns = math.floor(math.sqrt(n))
	if ns * ns >= n:
		print(2 * ns - 2)
	elif ns * (ns + 1) >= n:
		print(2 * ns - 1)
	else:
		print(2 * ns)


import math
n = int(input())
li = []
for i in range(n):
	li.append(int(input()))
for i in li:
	t = math.sqrt(i)
	if t % 1 == 0:
		print(int(2 * t - 2))
	elif t - math.floor(t) >= 0.5:
		print(2 * math.ceil(t) - 2)
	else:
		print(2 * math.ceil(t) - 3)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from math import gcd, ceil

def pre(s):
	n = len(s)
	pi = [0] * n
	for i in range(1, n):
		j = pi[i - 1]
		while j and s[i] != s[j]:
			j = pi[j - 1]
		if s[i] == s[j]:
			j += 1
		pi[i] = j
	return pi

def prod(a):
	ans = 1
	for each in a:
		ans = ans * each
	return ans

def lcm(a, b):
	return a * b // gcd(a, b)

def binary(x, length=16):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y
for _ in range(int(input()) if True else 1):
	n = int(input())
	if n == 1:
		print(0)
		continue
	from math import sqrt
	print(ceil(2 * sqrt(n)) - 2)


import math
CASES = int(input())
for _ in range(CASES):
	n = int(input())
	k = math.ceil(n ** 0.5)
	inc = k - 1
	y = math.ceil(n / k)
	copy = y - 1
	print(inc + copy)


from math import sqrt

def read_int():
	return int(input())

def read_ints():
	return map(int, input().split(' '))
t = read_int()
for case_num in range(t):
	n = read_int()
	mid = int(sqrt(n))
	ans = n
	for i in range(max(1, mid - 5), min(n, mid + 5) + 1):
		rem = n % i
		tot = i - 1 + n // i - 1
		if rem > 0:
			tot += 1
		ans = min(ans, tot)
	print(ans)


n = int(input())
for i in range(n):
	m = int(input())
	z = int(m ** 0.5)
	nat = 0
	nat += (z - 1) * 2
	m = m - z ** 2
	nat += m // z
	m = m % z
	if m != 0:
		nat += 1
	print(nat)


for i in range(int(input())):
	n = int(input())
	x = int(n ** (1 / 2))
	if n % x == 0:
		y = n // x
		if y * x >= n:
			print(x - 2 + y)
	else:
		y = n // x + 1
		print(y + x - 2)


from math import sqrt

def Solve():
	ns = []
	for t in range(int(input())):
		ns.append(int(input()))
	for n in ns:
		if n > 1:
			min_ = 9999999999999999999
			i = 1
			for i in range(int(sqrt(n)), n):
				if i + n / i < min_:
					min_ = i + n / i
				else:
					break
			if int(min_) - min_ < 0:
				print(int(min_) - 1)
			else:
				print(int(min_ - 2))
		else:
			print(0)
Solve()


import math
t = int(input())
for _ in range(t):
	n = int(input())
	q = int(math.sqrt(n))
	x = 1000000.0
	for i in range(1, q + 1):
		x = min(x, i - 1 + (n - 1) / i)
	print(int(x))


from sys import stdin, stdout
from math import gcd, log2, log10, floor, ceil, sqrt
import math
from collections import defaultdict, OrderedDict
from bisect import bisect_left
dict = defaultdict(int)

def fun(n):
	t = ceil(sqrt(n))
	return ceil(n / t) + t - 2
for i in range(int(input())):
	n = int(input())
	answer = fun(n)
	print(answer)


t = int(input())
for _ in range(t):
	n = int(input())
	ans = n - 1
	for i in range(2, int(n ** 0.5) + 1):
		x = n // i
		(m1, m2) = (min(i, x), max(i, x))
		ans = min(ans, m2 + m1 - 2 + bool(n % (i * x)))
	print(ans)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	x = int(input())
	ans = 100000.0
	for i in range(max(1, int(x ** 0.5) - 3), int(x ** 0.5) + 3):
		ans = min(ans, i - 1 + (x - 1) // i)
	print(ans)


import math
n = int(input())
for i in range(n):
	m = int(input())
	if m == 1:
		print(0)
	else:
		e = int(m ** 0.5)
		f = m - e
		g = math.ceil(f / e)
		print(g + (e - 1))


from sys import stdin, stdout
test = int(stdin.readline())
for _ in range(test):
	n = int(stdin.readline())
	ans = float('inf')
	s = int(n ** 0.5)
	if n == 1:
		print(0)
		continue
	for i in range(1, s + 10):
		temp = i - 1 + n // i - 1 + int(n % i != 0)
		ans = min(ans, temp)
	print(ans)


def cmp(key):
	return key[0]
from math import floor, ceil
t = int(input())
noswer = []
for i in range(t):
	n = int(input())
	naswer = 10000000000
	for j in range(int(n ** 0.5) * 2 - 10, int(n ** 0.5) * 2 + 10):
		if j < 0:
			continue
		add = floor(j / 2)
		mult = ceil(j / 2)
		result = (1 + add) * (mult + 1)
		if result >= n:
			noswer.append(j)
			break
print(*noswer, sep='\n')


from math import sqrt
T = int(input())
for t in range(T):
	n = int(input())
	root = int(sqrt(n))
	if root * root >= n:
		print(root + root - 2)
	elif (root + 1) * root >= n:
		print(root + root - 1)
	else:
		print(root + root)


for i in range(int(input())):
	k = int(input())
	n = 1
	counter = 1
	c = 0
	while k > n * (n + 1):
		n += 1
		c += 1
	a = n
	while a < k:
		counter += 1
		a = n * counter
		c += 1
	print(c)


t = int(input())
for i in range(t):
	n = int(input())
	if n == 1:
		print(0)
	elif n == 2:
		print(1)
	else:
		sq = int(n ** (1 / 2))
		ans = sq - 1
		temp_sq = sq + 1
		if sq * sq >= n:
			ans = ans + sq - 1
		elif sq * temp_sq >= n:
			ans = ans + sq
		else:
			ans = ans + sq + 1
		print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	sqrtn = int(n ** 0.5)
	ans = 1000000000.0
	for i in range(1, sqrtn + 7):
		val = i - 1 + (n - i) // i
		val += 1 if (n - i) % i > 0 else 0
		ans = min(ans, val)
	print(ans)


from math import sqrt
t = int(input())
for _ in range(t):
	n = int(input())
	d = int(sqrt(n))
	m = 0
	if n % d == 0:
		d = d - 1
	m += d
	d2 = n // (d + 1)
	if n == d2 * (d + 1):
		m += d2 - 1
	else:
		m += d2
	print(m)


import sys
import math
from collections import defaultdict as dd
mod = 1000000007

def ip(n):
	if n <= 1:
		return False
	if n == 2:
		return True
	if n % 2 == 0:
		return False
	s = int(math.sqrt(n)) + 1
	for i in range(3, s, 2):
		if n % i == 0:
			return False
	return True
T = 1
T = int(sys.stdin.readline())
for _ in range(T):
	n = int(input())
	flg = 0
	if n <= 3:
		print(n - 1)
		continue
	ans = 10 ** 10
	s = int(math.sqrt(n))
	for i in range(2, s + 1):
		if n % i == 0:
			j = n // i
			ans = min(ans, i + j - 2)
		else:
			j = n // i
			ans = min(ans, i + j - 1)
	print(ans)


import math
for _ in range(int(input())):
	n = int(int(input()))
	tem = math.ceil(n ** 0.5)
	res = tem - 1 + math.ceil(n / tem)
	print(res - 1)


import math
t = int(input())
for _ in range(t):
	n = int(input())
	x = math.ceil(math.sqrt(n))
	ans = int(x) + int(n / x)
	ans -= 2
	if int(x) * int(n / x) < n:
		print(ans + 1)
	else:
		print(ans)


import sys, math
t = int(input())
while t > 0:
	t -= 1
	input = sys.stdin.readline()
	n = int(input)
	if n == 1:
		print(0)
	elif n == 2:
		print(1)
	elif n == 3:
		print(2)
	else:
		a = int(math.sqrt(n))
		n = n - a * a
		if n != 0:
			print(2 * a + ((n - 1) // a + 1) - 2)
		else:
			print(2 * a - 2)


T = int(input())
ans = ''
for _ in range(T):
	n = int(input())
	l = 0
	r = 63244
	while l < r:
		m = (l + r) // 2
		t = m * m // 4 + m + 1
		if n == t:
			l = m
			r = m
		elif n > t:
			l = m + 1
		else:
			r = m
	ans += str(l) + '\n'
print(ans)


from sys import stdin, stdout
input = stdin.readline
print = stdout.write
for _ in range(int(input())):
	n = int(input())
	prev = 10000000000.0
	m = 1
	k = 0
	while m < 70000:
		if (n - m) % m == 0:
			k = (n - m) // m
		else:
			k = (n - m) // m + 1
		if m + k - 1 < prev:
			prev = m + k - 1
		m += 1
	print(str(prev) + '\n')


import math as m
for _ in range(int(input())):
	n = int(input())
	if n == 1:
		print(0)
	elif n == 2:
		print(1)
	elif n == 3:
		print(2)
	elif n == 4:
		print(2)
	elif n == 5:
		print(3)
	else:
		s = m.floor(m.sqrt(n))
		if n % s == 0:
			val = n // s - 1
		else:
			val = n // s
		print(s + val - 1)


from math import sqrt, ceil
T = int(input())
for case in range(T):
	n = int(input())
	print(ceil(2 * (sqrt(n) - 1)))


import math
t = int(input())
for h in range(t):
	n = int(input())
	sh = math.sqrt(n)
	ans = int(sh) - 1
	ans += int(n / int(sh))
	if n / int(sh) == n // int(sh):
		ans -= 1
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	root = round(n ** 0.5)
	rem = n % root
	if n == 1:
		print(0)
	elif n % root == 0:
		print(root + n // root - 2)
	else:
		print(root + n // root - 1)


from math import ceil
for _ in range(int(input())):
	n = int(input())
	a = int(n ** 0.5)
	for num in range(a, a + 5):
		if num * a >= n:
			p = num
			break
	ans = a - 1 + (p - 1)
	print(ans)


import math
import random
import heapq, bisect
import sys
from collections import deque, defaultdict
from fractions import Fraction
import sys
import threading
from collections import defaultdict
mod = 10 ** 9 + 7
mod1 = 998244353
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class TreeNode:

	def __init__(self, k, v):
		self.key = k
		self.value = v
		self.left = None
		self.right = None
		self.parent = None
		self.height = 1
		self.num_left = 1
		self.num_total = 1

class AvlTree:

	def __init__(self):
		self._tree = None

	def add(self, k, v):
		if not self._tree:
			self._tree = TreeNode(k, v)
			return
		node = self._add(k, v)
		if node:
			self._rebalance(node)

	def _add(self, k, v):
		node = self._tree
		while node:
			if k < node.key:
				if node.left:
					node = node.left
				else:
					node.left = TreeNode(k, v)
					node.left.parent = node
					return node.left
			elif node.key < k:
				if node.right:
					node = node.right
				else:
					node.right = TreeNode(k, v)
					node.right.parent = node
					return node.right
			else:
				node.value = v
				return

	@staticmethod
	def get_height(x):
		return x.height if x else 0

	@staticmethod
	def get_num_total(x):
		return x.num_total if x else 0

	def _rebalance(self, node):
		n = node
		while n:
			lh = self.get_height(n.left)
			rh = self.get_height(n.right)
			n.height = max(lh, rh) + 1
			balance_factor = lh - rh
			n.num_total = 1 + self.get_num_total(n.left) + self.get_num_total(n.right)
			n.num_left = 1 + self.get_num_total(n.left)
			if balance_factor > 1:
				if self.get_height(n.left.left) < self.get_height(n.left.right):
					self._rotate_left(n.left)
				self._rotate_right(n)
			elif balance_factor < -1:
				if self.get_height(n.right.right) < self.get_height(n.right.left):
					self._rotate_right(n.right)
				self._rotate_left(n)
			else:
				n = n.parent

	def _remove_one(self, node):
		replacement = node.left or node.right
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = replacement
			else:
				node.parent.right = replacement
			replacement.parent = node.parent
			node.parent = None
		else:
			self._tree = replacement
			replacement.parent = None
		node.left = None
		node.right = None
		node.parent = None
		self._rebalance(replacement)

	def _remove_leaf(self, node):
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = None
			else:
				node.parent.right = None
			self._rebalance(node.parent)
		else:
			self._tree = None
		node.parent = None
		node.left = None
		node.right = None

	def remove(self, k):
		node = self._get_node(k)
		if not node:
			return
		if AvlTree._is_leaf(node):
			self._remove_leaf(node)
			return
		if node.left and node.right:
			nxt = AvlTree._get_next(node)
			node.key = nxt.key
			node.value = nxt.value
			if self._is_leaf(nxt):
				self._remove_leaf(nxt)
			else:
				self._remove_one(nxt)
			self._rebalance(node)
		else:
			self._remove_one(node)

	def get(self, k):
		node = self._get_node(k)
		return node.value if node else -1

	def _get_node(self, k):
		if not self._tree:
			return None
		node = self._tree
		while node:
			if k < node.key:
				node = node.left
			elif node.key < k:
				node = node.right
			else:
				return node
		return None

	def get_at(self, pos):
		x = pos + 1
		node = self._tree
		while node:
			if x < node.num_left:
				node = node.left
			elif node.num_left < x:
				x -= node.num_left
				node = node.right
			else:
				return (node.key, node.value)
		raise IndexError('Out of ranges')

	@staticmethod
	def _is_left(node):
		return node.parent.left and node.parent.left == node

	@staticmethod
	def _is_leaf(node):
		return node.left is None and node.right is None

	def _rotate_right(self, node):
		if not node.parent:
			self._tree = node.left
			node.left.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.left
			node.left.parent = node.parent
		else:
			node.parent.right = node.left
			node.left.parent = node.parent
		bk = node.left.right
		node.left.right = node
		node.parent = node.left
		node.left = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	def _rotate_left(self, node):
		if not node.parent:
			self._tree = node.right
			node.right.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.right
			node.right.parent = node.parent
		else:
			node.parent.right = node.right
			node.right.parent = node.parent
		bk = node.right.left
		node.right.left = node
		node.parent = node.right
		node.right = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	@staticmethod
	def _get_next(node):
		if not node.right:
			return node.parent
		n = node.right
		while n.left:
			n = n.left
		return n

class SegmentTree1:

	def __init__(self, data, default=2 ** 30, func=lambda a, b: min(a, b)):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class SegmentTree:

	def __init__(self, data, default=0, func=lambda a, b: a + b):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD

def powm(a, n, m):
	if a == 1 or n == 0:
		return 1
	if n % 2 == 0:
		s = powm(a, n // 2, m)
		return s * s % m
	else:
		return a * powm(a, n - 1, m) % m

def sort_list(list1, list2):
	zipped_pairs = zip(list2, list1)
	z = [x for (_, x) in sorted(zipped_pairs)]
	return z

def product(l):
	por = 1
	for i in range(len(l)):
		por *= l[i]
	return por

def binarySearchCount(arr, n, key):
	left = 0
	right = n - 1
	count = 0
	while left <= right:
		mid = int((right + left) / 2)
		if arr[mid] < key:
			count = mid + 1
			left = mid + 1
		else:
			right = mid - 1
	return count

def countdig(n):
	c = 0
	while n > 0:
		n //= 10
		c += 1
	return c

def binary(x, length):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y

def countGreater(n, k):
	l = 0
	r = n - 1
	leftGreater = n
	while l <= r:
		m = int(l + (r - l) / 2)
		if a.get_at(m)[0] >= k:
			leftGreater = m
			r = m - 1
		else:
			l = m + 1
	return n - leftGreater

class TrieNode:

	def __init__(self):
		self.children = [None] * 26
		self.isEndOfWord = False

class Trie:

	def __init__(self):
		self.root = self.getNode()

	def getNode(self):
		return TrieNode()

	def _charToIndex(self, ch):
		return ord(ch) - ord('a')

	def insert(self, key):
		pCrawl = self.root
		length = len(key)
		for level in range(length):
			index = self._charToIndex(key[level])
			if not pCrawl.children[index]:
				pCrawl.children[index] = self.getNode()
			pCrawl = pCrawl.children[index]
		pCrawl.isEndOfWord = True

	def search(self, key):
		pCrawl = self.root
		length = len(key)
		for level in range(length):
			index = self._charToIndex(key[level])
			if not pCrawl.children[index]:
				return False
			pCrawl = pCrawl.children[index]
		return pCrawl != None and pCrawl.isEndOfWord

class Node:

	def __init__(self, data):
		self.data = data
		self.count = 0
		self.left = None
		self.right = None

class BinaryTrie:

	def __init__(self):
		self.root = Node(0)

	def insert(self, pre_xor):
		self.temp = self.root
		for i in range(31, -1, -1):
			val = pre_xor & 1 << i
			if val:
				if not self.temp.right:
					self.temp.right = Node(0)
				self.temp = self.temp.right
				self.temp.count += 1
			if not val:
				if not self.temp.left:
					self.temp.left = Node(0)
				self.temp = self.temp.left
				self.temp.count += 1
		self.temp.data = pre_xor

	def query(self, xor):
		self.temp = self.root
		for i in range(31, -1, -1):
			val = xor & 1 << i
			if not val:
				if self.temp.left and self.temp.left.count > 0:
					self.temp = self.temp.left
				elif self.temp.right:
					self.temp = self.temp.right
			elif self.temp.right and self.temp.right.count > 0:
				self.temp = self.temp.right
			elif self.temp.left:
				self.temp = self.temp.left
			self.temp.count -= 1
		return xor ^ self.temp.data
for ik in range(int(input())):
	n = int(input())
	if n == 1:
		print(0)
	elif n == 2:
		print(1)
	elif n == 3:
		print(2)
	elif n == 4:
		print(2)
	elif n == 5:
		print(3)
	elif n == 6:
		print(3)
	else:
		ans = n
		b = int(math.sqrt(n))
		for i in range(b - 2, b + 3):
			if i == 0:
				continue
			ans = min(ans, i - 1 + (n - 1) // i)
		print(ans)


import math
T = int(input())
for _ in range(T):
	n = int(input())
	c = 0
	rep = int(math.sqrt(n))
	c = rep - 1
	c += math.ceil(n / rep) - 1
	print(c)


import math
t = int(input())
for i in range(1, t + 1):
	n = float(input())
	x = math.ceil(2 * math.sqrt(n) - 2)
	print(x)


def check(n, r):
	i = 2 * r
	(a, b) = (r, r)
	while a * b < n:
		i += 1
		a = i // 2
		b = i - a
	return i - 2

def kum():
	t = int(input())
	for test in range(t):
		n = int(input())
		r = int(n ** 0.5)
		print(check(n, r))

def dd():
	k = 1000000000
	for i in range(1000):
		check(k, k ** 0.5)
kum()


import os
import sys
from io import BytesIO, IOBase
import math

def main():
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def binary(n):
	return bin(n).replace('0b', '')

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(i)
			n = n / i
	if n > 2:
		l.append(int(n))
	return l

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def maxPrimeFactors(n):
	maxPrime = -1
	while n % 2 == 0:
		maxPrime = 2
		n >>= 1
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			maxPrime = i
			n = n / i
	if n > 2:
		maxPrime = n
	return int(maxPrime)
for xyz in range(0, int(input())):
	n = int(input())
	if n == 1:
		print(0)
	else:
		ans = n + 1
		for i in range(1, n + 1):
			ca = i - 1
			ca += n // i
			ca -= 1
			ca += min(1, n % i)
			if ca > ans:
				break
			else:
				ans = ca
		print(ans)


import math
for _ in range(int(input())):
	n = int(input())
	ans = float('inf')
	for i in range(int(n ** 0.5) - 5, int(n ** 0.5) + 6):
		if i > 0:
			ans = min(ans, i - 1 + math.ceil((n - i) / i))
	print(ans)


import math
for _ in range(int(input())):
	n = int(input())
	i = 1
	res = 10 ** 9
	s = math.ceil(math.sqrt(n))
	for i in range(-6, 6):
		tmp = s - i
		if tmp < 1 or tmp > n:
			continue
		res = min(res, tmp - 1 + math.ceil((n - tmp) / tmp))
		i += 1
	print(res)


for _ in range(int(input())):
	a = int(input())
	flag = 0
	if a == 1 or a == 2 or a == 3:
		print(a - 1)
		continue
	cal = a ** 0.5
	if cal - int(cal):
		f = int(cal)
	else:
		flag = 1
		f = int(cal) - 1
	s = a // f - 1
	if a % f == 0:
		s -= 1
	if flag:
		print(f + s - 1)
	else:
		print(f + s)


import sys, collections
tc = int(sys.stdin.readline())
for _ in range(tc):
	n = int(sys.stdin.readline())
	left = int(n ** 0.5)
	right = n // left if n % left == 0 else n // left + 1
	print(left + right - 2)


import math
t = int(input())
for _ in range(t):
	n = int(input())
	x = math.ceil(math.sqrt(n))
	steps = x - 1
	steps += math.ceil(n / x) - 1
	print(steps)


import sys
input = sys.stdin.readline
t = int(input())
for tests in range(t):
	n = int(input())
	ki = int(n ** 0.5)
	ANS = n
	for i in range(max(1, ki - 10), min(n + 1, ki + 10)):
		(q, r) = divmod(n, i)
		if r == 0:
			ANS = min(ANS, i - 1 + q - 1)
		else:
			ANS = min(ANS, i + q - 1)
	print(ANS)


ans = []
for t in range(int(input())):
	n = int(input())
	s = 1
	cnt = 1
	turns = 0
	if n == 1:
		ans += [0]
		continue
	(L, R) = (0, n)
	while R - L > 1:
		M = (L + R) // 2
		if (1 + (M - 1) / 2) * (M - (M - 1) / 2) >= n:
			R = M
		else:
			L = M
	ans += [R - 1]
print(*ans, sep='\n')


import math
for _ in range(int(input())):
	n = int(input())
	if n == 1:
		print(0)
	else:
		result = n
		for i in range(max(1, math.floor(math.sqrt(n)) - 5), math.floor(math.sqrt(n)) + 5):
			result = min(result, i - 1 + math.ceil((n - i) / i))
		print(result)


import math
t = int(input())
for _ in range(t):
	n = int(input())
	num = int(math.sqrt(n))
	num1 = n // num
	ans = num + num1
	if num * num1 < n:
		ans = ans + 1
	print(ans - 2)


import math

def compute(n, s):
	carry = 1
	if n % s == 0:
		carry = 0
	return s - 1 + n // s - 1 + carry

def refine(n, value, iterable):
	for i in iterable:
		v = compute(n, i)
		if value >= v:
			value = min(value, v)
		else:
			break
	return value

def solve():
	n = int(input().strip())
	middle = int(math.sqrt(n))
	suboptimal = compute(n, middle)
	return min(suboptimal, refine(n, suboptimal, range(middle, 0, -1)), refine(n, suboptimal, range(middle, n)))
for _ in range(int(input().strip())):
	print(solve())


def cal(x, n):
	y = n // (x + 1)
	if n % (x + 1):
		y += 1
	return y + x
for _ in range(int(input())):
	n = int(input())
	a = 0
	while cal(a, n) >= cal(a + 1, n):
		a += 1
	print(cal(a, n) - 1)


import math
t = int(input())
for _ in range(t):
	n = int(input())
	if n == 1:
		print(0)
	else:
		sq = math.floor(math.sqrt(n))
		if sq * sq == n:
			print(2 * (sq - 1))
		else:
			min = sq
			res = min
			while True:
				res += 1
				if min * res >= n:
					break
			print(res - 1 + (min - 1))


import os
import math
true = True
false = False
from functools import reduce
is_dev = 'vscode' in os.environ
if is_dev:
	inF = open('in.txt', 'r')
	outF = open('out.txt', 'w')

def ins():
	return list(map(int, input_().split(' ')))

def inss():
	return list(input_().split(' '))

def input_():
	if is_dev:
		return inF.readline()[:-1]
	else:
		return input()

def ranin():
	return range(int(input_()))

def print_(data):
	if is_dev:
		outF.write(str(data) + '\n')
	else:
		print(data)
for _ in ranin():
	n = int(input_())
	if n == 1:
		print_(0)
	elif n == 2:
		print_(1)
	elif n == 3:
		print_(2)
	else:
		print_(math.ceil(math.sqrt(n) * 2 - 2))
if is_dev:
	outF.close()

	def compare_file():
		print(open('out.txt', 'r').read() == open('outactual.txt', 'r').read())
	compare_file()


import math
for _ in range(int(input())):
	n = int(input())
	c = int(math.sqrt(n))
	count = c - 1
	ans = math.ceil((n - c) / c)
	print(count + ans)


from math import sqrt
t = int(input())
for _ in range(t):
	n = int(input())
	ans = n - 1
	x = int(sqrt(n - 1) - 1)
	for i in range(max(x - 1, 0), x + 2):
		val = i - 1 + (n + i) // (i + 1)
		ans = min(ans, val)
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	k = int(n ** 0.5)
	h = k - 1
	if n % k == 0:
		h += n // k - 1
	else:
		h += n // k
	print(h)


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		k = n ** 0.5
		if k % 1 != 0:
			k = int(k + 1)
		else:
			k = int(k)
		r = (n - k) % k
		q = (n - k) // k
		if r == 0:
			cei = q
		else:
			cei = q + 1
		print(cei + k - 1)
main()


import math
for _ in range(int(input())):
	n = int(input())
	if n == 1:
		print('0')
	elif n == 2:
		print('1')
	else:
		k = math.floor(math.sqrt(n))
		if n % k == 0:
			print(n // k - 1 + k - 1)
		else:
			print(n // k + k - 1)


import sys
import math

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def rinput():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))
mod = int(1000000000.0) + 7
for _ in range(iinput()):
	n = iinput()
	if n == 1:
		print(0)
		continue
	s = math.sqrt(4 * n)
	if s % 1 == 0:
		s = int(s)
		print(s - 2)
	else:
		s = int(s)
		print(s - 1)


for __ in range(int(input())):
	n = int(input())
	ans = 10 ** 9
	for i in range(1, min(n, 10 ** 5)):
		ans = min(i - 1 + (n - 1) // i, 10 ** 6, ans)
	if ans == 10 ** 9:
		ans = 0
	print(ans)


for _ in range(int(input())):
	n = int(input())
	n -= 1
	for i in range(0, n + 1):
		a = i + i * (i // 2) - (i // 2) ** 2
		if a >= n:
			print(i)
			break


import sys
from collections import deque
from queue import PriorityQueue
from math import gcd
input_ = lambda : sys.stdin.readline().strip('\r\n')
ii = lambda : int(input_())
il = lambda : list(map(int, input_().split()))
ilf = lambda : list(map(float, input_().split()))
ip = lambda : input_()
fi = lambda : float(input_())
ap = lambda ab, bc, cd: ab[bc].append(cd)
li = lambda : list(input_())
pr = lambda x: print(x)
prinT = lambda x: print(x)
f = lambda : sys.stdout.flush()
mod = 10 ** 9 + 7
for _ in range(ii()):
	n = ii()
	mn = int(n ** 0.5)
	print(int(-(-n // mn) + mn - 2))


import random, math, sys
from copy import deepcopy as dc
from bisect import bisect_left, bisect_right
from collections import Counter
input = sys.stdin.readline

def solution(n):
	l = 1
	r = n + 1 - 1
	mini = float('inf')
	for i in range(max(1, int(math.sqrt(n + 1)) - 500), min(int(math.sqrt(n + 1)) + 10, n + 1)):
		mini = min(mini, math.ceil(n / i) + i - 2)
	return mini

def input_test():
	for _ in range(int(input())):
		n = int(input())
		print(solution(n))

def test():
	pass
input_test()


import math
t = int(input())
for _ in range(t):
	n = int(input())
	sqr = math.sqrt(n)
	if sqr.is_integer():
		print(int(2 * sqr - 2))
	else:
		f = math.floor(sqr)
		c = math.ceil(sqr)
		if c * f >= n:
			print(2 * f - 1)
		else:
			print(c + f - 1)


import math

def cal(n):
	if n == 1:
		return 0
	start = int(math.sqrt(n))
	cur = start * start
	res = (start - 1) * 2
	while cur < n:
		res += 1
		cur += start
	return res
t = int(input())
for _ in range(t):
	n = int(input())
	print(cal(n))


import math
t = int(input())
for _ in range(t):
	n = int(input())
	s = math.ceil(math.sqrt(n))
	if s * (s - 1) >= n:
		print(2 * s - 3)
	else:
		print(2 * s - 2)


import sys
input = sys.stdin.readline
from bisect import bisect_left
MAX = 64000
A = []
for i in range(MAX):
	A.append(i * i)
Q = int(input())
for _ in range(Q):
	N = int(input())
	a = bisect_left(A, N - 1)
	ans = N
	if a * a >= N:
		ans = min(ans, 2 * a - 2)
	if a * (a - 1) >= N:
		ans = min(ans, 2 * a - 3)
	if a * (a + 1) >= N:
		ans = min(ans, 2 * a - 1)
	if N == 1:
		ans = 0
	print(ans)


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

def minp():
	return map(int, input().split())

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

def solve(n):
	i = 1
	while i * i <= n:
		i += 1
	i -= 1
	if i:
		j = n // i
		return [i - 1, j - 1, n % i]
	return []
for _ in range(inp()):
	n = inp()
	if n == 1:
		print(0)
		continue
	l = solve(n)
	s = l[0] + l[1]
	if l[2]:
		print(s + 1)
	else:
		print(s)


import sys, bisect, string, math, time, functools, random, fractions
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
from itertools import permutations, combinations, groupby
rep = range
R = range

def Golf():
	(n, *t) = map(int, open(0).read().split())

def I():
	return int(input())

def S_():
	return input()

def IS():
	return input().split()

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

def MI():
	return map(int, input().split())

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

def LI_():
	return [int(i) - 1 for i in input().split()]

def NI(n):
	return [int(input()) for i in range(n)]

def NI_(n):
	return [int(input()) - 1 for i in range(n)]

def NLI(n):
	return [[int(i) for i in input().split()] for i in range(n)]

def NLI_(n):
	return [[int(i) - 1 for i in input().split()] for i in range(n)]

def StoLI():
	return [ord(i) - 97 for i in input()]

def ItoS(n):
	return chr(n + 97)

def LtoS(ls):
	return ''.join([chr(i + 97) for i in ls])

def RA():
	return map(int, open(0).read().split())

def RLI(n=8, a=1, b=10):
	return [random.randint(a, b) for i in range(n)]

def RI(a=1, b=10):
	return random.randint(a, b)

def INP():
	N = 10
	A = 10
	n = random.randint(1, N)
	a = [random.randint(1, A) for i in range(n)]
	return (n, a)

def Rtest(T):
	(case, err) = (0, 0)
	for i in range(T):
		inp = INP()
		a1 = naive(*inp)
		a2 = solve(*inp)
		if a1 != a2:
			print((a1, a2), inp)
			err += 1
		case += 1
	print('Tested', case, 'case with', err, 'errors')

def GI(V, E, ls=None, Directed=False, index=1):
	org_inp = []
	g = [[] for i in range(V)]
	FromStdin = True if ls == None else False
	for i in range(E):
		if FromStdin:
			inp = LI()
			org_inp.append(inp)
		else:
			inp = ls[i]
		if len(inp) == 2:
			(a, b) = inp
			c = 1
		else:
			(a, b, c) = inp
		if index == 1:
			a -= 1
			b -= 1
		aa = (a, c)
		bb = (b, c)
		g[a].append(bb)
		if not Directed:
			g[b].append(aa)
	return (g, org_inp)

def GGI(h, w, search=None, replacement_of_found='.', mp_def={'#': 1, '.': 0}, boundary=1):
	mp = [boundary] * (w + 2)
	found = {}
	for i in R(h):
		s = input()
		for char in search:
			if char in s:
				found[char] = (i + 1) * (w + 2) + s.index(char) + 1
				mp_def[char] = mp_def[replacement_of_found]
		mp += [boundary] + [mp_def[j] for j in s] + [boundary]
	mp += [boundary] * (w + 2)
	return (h + 2, w + 2, mp, found)

def TI(n):
	return GI(n, n - 1)

def accum(ls):
	rt = [0]
	for i in ls:
		rt += [rt[-1] + i]
	return rt

def bit_combination(n, base=2):
	rt = []
	for tb in R(base ** n):
		s = [tb // base ** bt % base for bt in R(n)]
		rt += [s]
	return rt

def gcd(x, y):
	if y == 0:
		return x
	if x % y == 0:
		return y
	while x % y != 0:
		(x, y) = (y, x % y)
	return y

def YN(x):
	print(['NO', 'YES'][x])

def Yn(x):
	print(['No', 'Yes'][x])

def show(*inp, end='\n'):
	if show_flg:
		print(*inp, end=end)
mo = 10 ** 9 + 7
inf = float('inf')
FourNb = [(-1, 0), (1, 0), (0, 1), (0, -1)]
EightNb = [(-1, 0), (1, 0), (0, 1), (0, -1), (1, 1), (-1, -1), (1, -1), (-1, 1)]
compas = dict(zip('WENS', FourNb))
cursol = dict(zip('LRUD', FourNb))
l_alp = string.ascii_lowercase
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
input = lambda : sys.stdin.readline().rstrip()
show_flg = False
show_flg = True
ans = 0
for _ in range(I()):
	ans = inf
	n = I()
	x = max(int(n ** 0.5 - 1), 0)
	for a in range(x, x + 5):
		for b in range(x, x + 5):
			if (a + 1) * (b + 1) >= n:
				ans = min(ans, a + b)
	print(ans)


from math import *
for s in [*open(0)][1:]:
	print(ceil(2 * sqrt(int(s))) - 2)


import math
t = int(input())
for i in range(t):
	n = int(input())
	m = math.sqrt(n)
	m = math.ceil(m)
	a = math.ceil(n / m) - 1
	print(m - 1 + a)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def RLL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

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

def print_list(l):
	print(' '.join(map(str, l)))
from math import ceil, floor, sqrt, pow
for _ in range(N()):
	n = N()
	res = float('inf')
	for i in range(int(sqrt(n)) + 5, max(int(sqrt(n)) - 5, -1), -1):
		res = min(res, i + ceil(n / (i + 1)) - 1)
	print(res)


from math import ceil
for _ in range(int(input())):
	n = int(input())
	b = ceil(pow(n, 0.5))
	a = ceil(n / b)
	ans = a + b - 2
	print(ans)


from sys import stdin

class Input:

	def __init__(self):
		self.it = iter(stdin.readlines())

	def line(self):
		return next(self.it).strip()

	def array(self, sep=' ', cast=int):
		return list(map(cast, self.line().split(sep=sep)))

def testcases(unknown=False):
	inpt = Input()

	def testcases_decorator(func):
		(cases,) = [0] if unknown else inpt.array()
		while unknown or cases > 0:
			try:
				func(inpt)
				cases -= 1
			except StopIteration:
				break
	return testcases_decorator
import math

@testcases()
def solve(inpt):
	(n,) = inpt.array()
	a = int(math.sqrt(n))
	b = (n + a - 1) // a
	print(a + b - 2)


import sys
import math
input = sys.stdin.readline

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

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

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
t = inp()
for _ in range(t):
	n = inp()
	ans = n
	limit = int(math.sqrt(n + 1)) + 1
	for i in range(1, limit + 1):
		temp = i + (n - i - 1) // i
		ans = min(ans, temp)
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	rootn = max(1, int(n ** 0.5) - 2)
	tmp = 1 << 32
	for j in range(rootn, rootn + 4):
		if n % j == 0:
			tmp = min(tmp, j + n // j - 2)
		else:
			tmp = min(tmp, j - 1 + n // j)
	print(tmp)


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
from collections import deque, Counter, OrderedDict, defaultdict
from itertools import permutations, combinations
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def si():
	return input()

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

def msi():
	return map(str, input().strip().split())

def li():
	return list(mi())

def dmain():
	sys.setrecursionlimit(1000000)
	threading.stack_size(1024000)
	thread = threading.Thread(target=main)
	thread.start()
from collections import deque, Counter, OrderedDict, defaultdict
from math import *
from itertools import permutations, combinations
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
vow = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def getKey(item):
	return item[1]

def sort2(l):
	return sorted(l, key=getKey, reverse=True)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def ceil(x, y):
	if x % y == 0:
		return x // y
	else:
		return x // y + 1

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def expo(x, y, m):
	if y == 0:
		return 1
	elif y % 2 == 0:
		return expo(x * x % m, y / 2, m)
	else:
		return x * expo(x * x % m, (y - 1) / 2, m) % m

def gcd(a, b):
	if a == 0:
		return (b, 0, 1)
	(gc, x1, y1) = gcd(b % a, a)
	x = y1 - b // a * x1
	y = x1
	return (gc, x, y)

def sieve(n):
	arr = [True] * (n + 1)
	arr[0] = False
	arr[1] = False
	for i in range(4, n + 1, 2):
		arr[i] = False
	for i in range(3, int(sqrt(n)) + 1, 2):
		if arr[i] == True:
			for j in range(i * i, n + 1, i):
				arr[j] = False
	return arr

def modInverse(x, y):
	(gc, x1, y1) = gcd(x, y)
	return (y1 + y) % y

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def read():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def main():
	for _ in range(ii()):
		n = ii()
		val = int(sqrt(n))
		if n == 1:
			print(0)
		elif n == 2:
			print(1)
		else:
			val = ceil(n - val, val) + val - 1
			print(val)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import math
t = int(input())
while t != 0:
	n = int(input())
	if n == 1:
		print(0)
	else:
		p = math.ceil(math.sqrt(n))
		ans = 0
		ans += p
		ans += math.ceil(n / p)
		print(ans - 2)
	t -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	ans = n - 1
	v = 2
	while 1:
		if (n - v) % v == 0:
			x = (n - v) // v
		else:
			x = (n - v) // v + 1
		if x + v - 1 <= ans:
			ans = x + v - 1
		else:
			break
		v += 1
	print(ans)


import math
t = int(input())
while t:
	t -= 1
	n = int(input())
	k = n ** 0.5
	k *= 2
	p = math.floor(k)
	if int(n ** 0.5) != n ** 0.5:
		print(p - 1)
	else:
		print(p - 2)


t = int(input())
for _ in range(t):
	n = int(input())
	lst = []
	for x in range(1, int(n ** 0.5) + 1):
		lst += [(n - x - 1) // x + 1 + x - 1]
	print(min(lst))


import math
t = int(input())
for i in range(t):
	n = int(input())
	square = 0
	count = 0
	for j in range(1, n + 1):
		if j * j < n:
			continue
		else:
			square = j
			break
	count1 = int(math.ceil(n / square)) - 1
	count = square - 1 + count1
	print(count)


import sys, math
import io, os
from bisect import bisect_left as bl, bisect_right as br, insort
from heapq import heapify, heappush, heappop
from collections import defaultdict as dd, deque, Counter

def data():
	return sys.stdin.readline().strip()

def mdata():
	return list(map(int, data().split()))

def outl(var):
	sys.stdout.write('\n'.join(map(str, var)) + '\n')

def out(var):
	sys.stdout.write(str(var) + '\n')
from decimal import Decimal
mod = 998244353
INF = float('inf')
for t in range(int(data())):
	n = int(data())
	k = int(n ** 0.5)
	out(n // k + k - 2 + (1 if n % k else 0))


import os, io, sys, time, collections, math, pprint, itertools as it, operator as op, bisect as bs, functools as fn
(maxx, localsys, mod) = (float('inf'), 0, int(1000000000.0 + 7))
nCr = lambda n, r: reduce(mul, range(n - r + 1, n + 1), 1) // factorial(r)
ceil = lambda n, x: (n + x - 1) // x
(osi, oso) = ('/home/priyanshu/Documents/cp/input.txt', '/home/priyanshu/Documents/cp/output.txt')
if os.path.exists(osi):
	sys.stdin = open(osi, 'r')
	sys.stdout = open(oso, 'w')
input = sys.stdin.readline

def maps():
	return map(int, input().split())
for _ in range(int(input())):
	n = int(input())
	ans = maxx
	for x in range(1, int(math.sqrt(n)) + 1):
		ans = min(ans, x - 1 + ceil(n - x, x))
	print(ans)


kl = int(input())
for i in range(kl):
	n = int(input())
	k = int(n ** 0.5)
	if n > k * (k + 1):
		print(k * 2)
	elif n == k * k:
		print(2 * k - 2)
	else:
		print(k * 2 - 1)


from sys import stdin, stdout
from collections import Counter
from itertools import permutations
import bisect
import math
I = lambda : map(int, stdin.readline().split())
I1 = lambda : stdin.readline()
for _ in range(int(I1())):
	n = int(I1())
	x = int(math.sqrt(n))
	ans = x - 1 + math.ceil((n - x) / x)
	print(ans)


t = int(input())

def f(k):
	r = k // 2
	return k * r + k - r * r + 1
for _ in range(t):
	n = int(input())
	lo = -1
	hi = n
	while lo + 1 < hi:
		mid = (lo + hi) // 2
		if f(mid) < n:
			lo = mid
		else:
			hi = mid
	print(hi)


def intput():
	return int(input())

def f(x):
	return (n + x - 1) // x + (x - 1)
for _ in range(int(input())):
	n = intput()
	ans = int(1000000000.0)
	for i in range(1, int(n ** 0.5) + 1):
		ans = min(ans, f(i))
	print(ans - 1)


t = int(input())
for _ in range(t):
	n = int(input())
	if n == 1:
		print(0)
	else:
		r = int(n ** 0.5)
		s = 2 * r - 1
		if n == r ** 2:
			s -= 1
		elif n > r + r ** 2:
			s += 1
		print(s)


import math
t = int(input())

def solve():
	n = int(input())
	s = int(n ** 0.5)
	ans1 = s - 1 + math.ceil((n - s) / s)
	ans2 = n - 1
	print(min(ans1, ans2))
for i in range(t):
	solve()


t = int(input())
for _ in range(t):
	n = int(input())
	ans = float('inf')
	for i in range(1, int(n ** 0.5 + 10)):
		cnt = i - 1
		cnt += (n - i + i - 1) // i
		ans = min(ans, cnt)
	print(ans)


import sys, collections, math, itertools

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def input():
	return sys.stdin.readline().strip()
mod = 1000000007
for _ in range(int(input())):
	n = int(input())
	nroot = int(math.sqrt(n))
	if nroot * nroot >= n:
		print(2 * nroot - 2)
	elif (nroot + 1) * nroot >= n:
		print(2 * nroot - 1)
	else:
		print(2 * nroot)


from math import *
for t in range(int(input())):
	n = int(input())
	val = int(n ** 0.5)
	count = val - 1
	while 1:
		if ceil(n / (val + 1)) < ceil(n / val) - 1:
			val += 1
			count += 1
		else:
			count += n // val
			if n % val:
				pass
			else:
				count -= 1
			break
	print(count)


import math
no_cases = int(input())
for i in range(no_cases):
	inp = input()
	bound = int(inp)
	start = 1
	best_moves = 1000000001
	moves = math.sqrt(bound) - 2
	moves = int(moves)
	if bound == 1:
		print(0)
		continue
	while True:
		moves += 1
		y = math.ceil(bound / (1 + moves)) - 1
		if moves + y <= best_moves:
			best_moves = moves + y
		else:
			print(best_moves)
			break


t = int(input())
for i in range(t):
	n = int(input())
	s = 1
	left = 0
	right = n - 1
	mid = (left + right) // 2
	while right - left > 1:
		ans = mid
		x = (ans + 1) // 2 + 1
		y = (ans + 1) // 2
		if (ans + 1) % 2 == 1:
			y += 1
		s = x * y
		if s == n:
			right = mid
			break
		elif s < n:
			left = mid
			mid = (left + right) // 2
		else:
			right = mid
			mid = (left + right) // 2
	print(right)


import math

def solve(n):
	a = math.ceil(n ** 0.5)
	b = math.ceil(n / a)
	return a + b - 2
t = int(input())
for _ in range(t):
	n = int(input())
	result = solve(n)
	print(result)


import os, io
import math
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
t = int(input())
for _ in range(t):
	n = int(input())
	k = math.floor(math.sqrt(4 * n))
	for i in range(k - 2, k + 3):
		if i * i >= 4 * n:
			print(i - 2)
			break


import math
import sys
for _ in range(int(input())):
	n = int(input())
	if n == 1:
		print(0)
		continue
	ans = sys.maxsize
	for x in range(1, math.floor(math.sqrt(n)) + 1):
		ans = min(ans, x - 1 + (n - x + x - 1) // x)
	print(ans)


import math
for _ in range(int(input())):
	x = int(input())
	f = x ** 0.5
	c = math.floor(math.ceil(2 * f) - 2)
	print(c)


T = int(input())
res = list()
for _ in range(T):
	n = int(input())
	if n == 1:
		res.append(0)
		continue
	root = int(n ** (1 / 2))
	ans = root - 1
	a = int((n - root) / root)
	if (n - root) % root != 0:
		ans += 1
	res.append(ans + a)
for i in res:
	print(i)


def f(k):
	r = k // 2
	return k * r + k - r * r + 1
t = int(input())
for i in range(t):
	n = int(input())
	A = 100000
	B = -1
	while A - B > 1:
		C = (A + B) // 2
		if f(C) < n:
			B = C
		else:
			A = C
	print(A)


def get_number(x):
	if x == 1:
		return 0
	total = 0
	y = int(x ** 0.5)
	total += 2 * (y - 1)
	sq = y ** 2
	if sq == x:
		return total
	while True:
		if sq + y < x:
			total += 1
			sq += y
		else:
			break
	total += 1
	return total
t = int(input())
for _ in range(t):
	x = int(input())
	print(get_number(x))


from sys import maxsize
from math import ceil, sqrt
el = None
for _ in range(int(input())):
	z = int(input())
	ans = maxsize
	for i in range(int(sqrt(z)), int(sqrt(z)) + 100):
		cost = i - 1
		cost += ceil(z / i) - 1
		if ans > cost:
			el = i
		ans = min(ans, cost)
	if z == 1:
		print(0)
	else:
		print(ans)


def round_up(x):
	if x % 1 == 0:
		return int(x)
	else:
		return int(x // 1 + 1)
t = int(input())
for _ in range(t):
	n = int(input())
	answer = round_up(2 * n ** 0.5 - 2)
	print(answer)


import math
for _ in range(int(input())):
	n = int(input())
	m = 1000000000.0 + 7
	for i in range(1, int(math.sqrt(n) + 1)):
		m = min(m, i - 1 + (n - 1) // i)
	print(m)


import math

def sovle(n):
	a = math.floor(math.sqrt(n))
	b = math.ceil(n / a) - 1
	print(b + a - 1)
for _ in range(int(input())):
	n = int(input())
	sovle(n)


from bisect import *
from collections import *
from math import *
from heapq import *
from typing import List
from itertools import *
from operator import *
from functools import *
import sys
t = int(input())
for i in range(t):
	n = int(input())
	x = int(sqrt(n))
	if x * x == n:
		ans = 2 * x - 2
	elif x * (x + 1) >= n:
		ans = 2 * x - 1
	else:
		ans = 2 * x
	print(ans)


import math
for _ in range(int(input())):
	n = int(input())
	m = math.sqrt(n)
	ans = int(m) - 1
	n -= m
	ans += int(math.ceil(n / int(m)))
	print(ans)


import math
n = int(input())
for index in range(0, n):
	num = int(input())
	output = 2 * (math.ceil(math.sqrt(num)) - 1)
	numTest = int(output / 2 + 1)
	if numTest * (numTest - 1) >= num:
		print(output - 1)
	else:
		print(output)


import math
t = int(input())
for _ in range(t):
	n = int(input())
	ans = 1000000000
	x = 1
	while x * x <= n:
		ans = min(ans, x - 1 + int(math.ceil(n - x + x - 1) / x))
		x += 1
	print(ans)


import math
for _ in range(int(input())):
	n = int(input())
	x = int(n ** 0.5)
	if n % (x + 1) == 0:
		x += 1
	o = 0
	if n % x != 0:
		o = 1
	print(x - 2 + n // x + o)


n = int(input())

def sqrt(x):
	return x ** (1 / 2)
for i in range(0, n):
	x = int(input())
	tmp = int(sqrt(x - 1)) + 1
	print(tmp + (x - 1) // tmp - 1)


from math import *
from decimal import *
from fractions import *
for _ in range(int(input())):
	n = int(input())
	a = int(sqrt(n))
	ans = 10 ** 18
	for i in range(-5, 6):
		z2 = a - i
		if z2 > n or z2 < 1:
			continue
		ans = min(ans, z2 - 2 + (n + z2 - 1) // z2)
	print(ans)


import math
tests = int(input())
for _ in range(tests):
	m = int(input())
	sqt = int(math.sqrt(m))
	res = sqt + m // sqt - 2 + (1 if m % sqt else 0)
	print(res)


from math import sqrt
for _ in range(int(input())):
	n = int(input())
	res = n
	for i in range(1, n):
		if i * i > n:
			break
		now = n // i
		if n % i != 0:
			now += 1
		now += i - 2
		res = min(res, now)
	print(res if n != 1 else 0)


import math
t = int(input())
while t > 0:
	t = t - 1
	n = int(input())
	x = math.floor(math.sqrt(n))
	ans = math.ceil((n - x) / x) + (x - 1)
	print(ans)


from math import sqrt, ceil
for t in range(int(input())):
	n = int(input())
	x = int(sqrt(n))
	res = x - 1
	res += ceil(n / x) - 1
	print(res)


T = int(input())
for _ in range(T):
	n = int(input())
	if n == 1:
		print(0)
		continue
	a = int(n ** (1 / 2) * 2 - 2)
	if n ** (1 / 2) % 1 != 0:
		a += 1
	print(a)


import sys
import math
for i in range(int(input())):
	n = int(input())
	ans = sys.maxsize
	x = int(math.sqrt(n))
	for i in range(x - 5, x + 6):
		if i > n and i < 1:
			continue
		else:
			ans = min(ans, x - 1 + (n - x) // x + (0 if (n - x) % x == 0 else 1))
	print(ans)


import math
from sys import stdin
from sys import setrecursionlimit
setrecursionlimit(100000)

def put():
	return map(int, stdin.readline().split())
for _ in range(int(input())):
	n = int(input())
	import math
	ans = int(math.sqrt(n)) - 1
	if n % (ans + 1) == 0:
		ans += int(n / (ans + 1)) - 1
	else:
		ans += int(n / (ans + 1))
	print(ans)


import math
for _ in range(int(input())):
	n = int(input())
	count = 0
	a = [1]
	x = math.sqrt(n) - 1
	y = math.sqrt(n) - 1
	print(math.ceil(x + y))


from sys import stdin, stdout, setrecursionlimit
import heapq
from math import gcd, ceil, sqrt
from collections import Counter, deque
from bisect import bisect_left, bisect_right
from itertools import combinations, permutations
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()
setrecursionlimit(100000)
mod = 1000000007
tc = ii1()
for _ in range(tc):
	n = ii1()
	ans = n - 1
	sq = int(n ** 0.5)
	for i in range(sq - 100, sq + 100):
		if i > 0:
			ans = min(ans, i - 1 + ceil(n / i) - 1)
	print(ans)


import math
for _ in range(int(input())):
	n = int(input())
	s = math.sqrt(n)
	k = n / s
	print(math.ceil(k + s) - 2)


import math
for _ in range(int(input())):
	n = int(input())
	b = []
	if n < 4:
		print(n - 1)
		continue
	for i in range(max(1, int(math.sqrt(n)) - 5), int(math.sqrt(n)) + 6):
		k = i - 1 + n // i
		if n % i == 0:
			b.append(k - 1)
		else:
			b.append(k)
	print(min(b))


from collections import *
from heapq import *
from math import *
from functools import *
inf = 8765456789098765

def score(mid, n):
	return (n - 1) / mid + mid - 1
t = int(input())
while t:
	t -= 1
	n = int(input())
	(l, r) = (1, 10 ** 9)
	while l < r:
		mid = (l + r) // 2
		t1 = score(mid, n)
		t2 = score(mid + 1, n)
		if t1 < t2:
			r = mid
		else:
			l = mid + 1
	print(floor(score(l, n)))


import math
cs = int(input())
for c in range(cs):
	obtain = int(input())
	start = [1]
	sq = math.floor(math.sqrt(obtain))
	steps1 = sq - 1
	repeat = math.ceil(obtain / sq)
	steps2 = repeat - 1
	print(steps1 + steps2)


def solve(n):
	ret = int(n ** (1 / 2))
	count = ret - 1
	count2 = 1
	while count2 * ret < n:
		count2 += 1
	print(count2 + count - 1)
t = int(input())
for _ in range(t):
	n = int(input())
	solve(n)


def f(x):
	sq = x ** 0.5
	isq = int(sq)
	bel = isq ** 2
	if sq % 1 == 0:
		sub = 2
	elif x <= bel + isq:
		sub = 1
	else:
		sub = 0
	if x == 1:
		return 0
	else:
		return 2 * isq - sub
n = int(input())
L = [int(input()) for i in range(n)]
for x in L:
	print(f(x))


from sys import stdin
input = stdin.readline
from math import sqrt, ceil

def solve():
	n = int(input())
	r = int(sqrt(n))
	m = ceil(n / r)
	print(m + r - 2)
t = int(input())
for _ in range(t):
	solve()


T = int(input())
r = 1

def getstep(increase, n):
	return (n - 2 - increase) // (increase + 1) + 1 + increase
while r <= T:
	n = int(input())
	optical = int(n ** 0.5) - 1
	minimum = max(0, optical - 100)
	maximum = optical + 100
	ans = n
	for i in range(minimum, maximum):
		ans = min(ans, getstep(i, n))
	print(ans)
	r += 1


import math
for i in range(int(input())):
	m = int(input())
	i = math.ceil(math.sqrt(m))
	print(int(i + (m + i - 1) / i - 2))


for _ in range(int(input())):
	n = int(input())
	ans = 0
	temp = n
	i = 2
	final = float('inf')
	while temp > i:
		temp = (n + i - 1) // i
		ans += 1
		final = min(final, i - 1 + temp - 1)
		i += 1
	if n == 1:
		final = 0
	elif n == 2:
		final = 1
	print(final)


import math
a = int(input())
while a > 0:
	b = int(input())
	c = int(math.sqrt(b))
	o = c - 1
	if c * c >= b:
		print(o + c - 1)
	elif (c + 1) * c >= b:
		print(o + c)
	elif (c + 1) * (c + 1) >= b:
		print(o + c + 1)
	a = a - 1


from math import *
for _ in range(int(input())):
	n = int(input())
	m = ceil(sqrt(n))
	step = m - 1
	a = ceil(n / m)
	steps = step + (a - 1)
	print(steps)


import math

def ceil_div(a, b):
	return (a + b - 1) // b
t = int(input())
while t:
	t -= 1
	n = int(input())
	sqr_root = int(math.floor(math.sqrt(n)))
	n = n - sqr_root * sqr_root
	ans = 2 * (sqr_root - 1) + ceil_div(n, sqr_root)
	print(ans)


t = int(input())

def solve(n):
	if n == 1:
		return 0
	q = int(n ** 0.5)
	if q ** 2 == n:
		return q * 2 - 2
	elif q * (q + 1) < n:
		return q * 2
	else:
		return q * 2 - 1
for i in ' ' * t:
	print(solve(int(input())))


from math import ceil, sqrt
for _ in range(int(input())):
	n = int(input())
	a_1 = ceil(2 * sqrt(n) - 2)
	print(a_1)


for i in range(int(input())):
	n = int(input())
	max_result = float('inf')
	for i in range(1, int(n ** (1 / 2)) + 1):
		result = 0
		if n % i != 0:
			result += 1
		result += n // i + (i - 1) - 1
		max_result = min(result, max_result)
	print(max_result)


import math
t = int(input())
results = []
for q in range(t):
	n = int(input())
	result = 10 ** 10
	if math.ceil(math.sqrt(n)) <= 5:
		k = 1
	else:
		k = math.ceil(math.sqrt(n)) - 5
	for i in range(k, math.ceil(math.sqrt(n)) + 5):
		if result > i - 1 + math.ceil((n - i) / i):
			result = i - 1 + math.ceil((n - i) / i)
	results.append(result)
for i in results:
	print(i)


import math
t = int(input())
for i in range(t):
	n = int(input())
	if n == 1:
		print(0)
	elif n == 2:
		print(1)
	else:
		a = int(math.sqrt(n))
		b = a + 1
		u = math.ceil((n - a) / a) + (a - 1)
		v = math.ceil((n - b) / b) + (b - 1)
		print(min(u, v))


import math
T = int(input())
for i in range(T):
	n = int(input())
	nr = math.floor(math.sqrt(n))
	if nr * nr >= n:
		print(int(2 * nr - 2))
	elif nr * (nr + 1) >= n:
		print(int(2 * nr - 1))
	else:
		print(int(2 * nr))


import sys
import math as m

def main():
	pass

def binary(n):
	return bin(n).replace('0b', '')

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def lts(l):
	s = ''.join(map(str, l))
	return s

def stl(s):
	l = list(s)
	return l
mod = int(1000000000.0) + 7

def sinp():
	return sys.stdin.readline().strip()

def iinp():
	return int(input())

def ninp():
	return map(int, sys.stdin.readline().strip().split())

def linp():
	return list(map(int, sys.stdin.readline().strip().split()))

def p(a):
	print(a)

def p2(a, b):
	print(a, b)
for _ in range(iinp()):
	n = iinp()
	a = m.floor(m.sqrt(n))
	b = m.sqrt(n)
	if b - a > 0.5:
		ans = a + a
	elif b - a == 0:
		ans = a - 1 + a - 1
	else:
		ans = a - 1 + a
	if n == 1:
		print(0)
	else:
		print(ans)


import math
t = int(input())
for i in range(t):
	n = int(input())
	val = math.ceil(math.sqrt(n))
	print(val - 1 + math.ceil((n - val) / val))


import math
for i in range(int(input())):
	a = int(input())
	b = math.sqrt(a) - 1
	print(math.ceil(b * 2))


from sys import stdin, stdout
import math
import heapq
import collections
input = stdin.readline

def inputnum():
	return int(input())

def inputnums():
	return map(int, input().split())

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

def inputstring():
	return [x for x in input()]

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

def inputstringnum():
	return [ord(x) - ord('a') for x in input()]

def inputmatrixchar(rows):
	arr2d = [[j for j in input().strip()] for i in range(rows)]
	return arr2d

def inputmatrixint(rows):
	arr2d = []
	for _ in range(rows):
		arr2d.append([int(i) for i in input().split()])
	return arr2d
t = int(input())
for q in range(t):
	n = inputnum()
	x = math.floor(math.sqrt(n))
	if x * x >= n:
		print(2 * x - 2)
	elif (x + 1) * x >= n:
		print(2 * x - 1)
	else:
		print(2 * x)


n = int(input())
for i in range(n):
	x = int(input())
	if x == 1:
		print(0)
	elif x ** 0.5 * 2 == int(x ** 0.5 * 2):
		print(int(x ** 0.5 * 2) - 2)
	else:
		print(int(x ** 0.5 * 2) - 1)


t = int(input())
dp = [0] * 63245
for _ in range(t):
	n = int(input())
	dp[0] = 1
	maxs = 1
	maxs_cnt = 1
	re = 1
	cnt = 0
	while re < n:
		cnt += 1
		if n - re >= maxs:
			if maxs_cnt >= 2:
				maxs += 1
				dp[cnt] = dp[cnt - 1] + maxs
				maxs_cnt = 1
			else:
				dp[cnt] = dp[cnt - 1] + maxs
				maxs_cnt += 1
		else:
			dp[cnt] = dp[cnt - 1] + (n - re)
		re = dp[cnt]
	print(cnt)


import sys, os, io
input = sys.stdin.readline
T = int(input())
ans = [0] * T
for t in range(T):
	n = int(input())
	ans[t] = n
	for p in range(1, n + 1):
		cnt = p - 2 - -n // p
		if ans[t] >= cnt:
			ans[t] = cnt
		else:
			break
print(*ans, sep='\n')


from math import sqrt, floor
t = int(input())
w = []
for i in range(t):
	n = int(input())
	if n == 1:
		w.append(0)
	else:
		rr = floor(sqrt(n))
		w.append(rr - 1 + (n - 1) // rr)
for i in w:
	print(i)


import math

def countOps(num: int) -> int:
	left_border = math.floor(math.sqrt(n))
	right_border = left_border + 1
	t = left_border if n - left_border ** 2 < right_border ** 2 - n else right_border
	ops = t - 1 + (math.ceil(n / t) - 1)
	return ops
tests = int(input())
ans = []
for i in range(tests):
	n = int(input())
	ans.append(countOps(n))
print(*ans, sep='\n')


import os
import heapq
import sys, threading
import math
import operator
from collections import defaultdict, deque
from io import BytesIO, IOBase
sys.setrecursionlimit(10 ** 5)

def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)

def inpt():
	return [int(k) for k in input().split()]

def main():
	for _ in range(int(input())):
		n = int(input())
		if n == 1:
			print(0)
			continue
		ans = 0
		root = int(n ** 0.5)
		fr = [-1, -2, -3, -4, -5, 0, 1, 2, 3, 4, 5, 6]
		ans = 10 ** 9
		for i in fr:
			val = root + i
			if val <= 0 or val > n:
				continue
			ans = min(ans, val - 1 + math.ceil((n - val) / val))
		print(ans)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import math
from datetime import date
import sys
input = sys.stdin.readline

def main():
	t = int(input())
	while t > 0:
		t -= 1
		n = int(input())
		ans = 10 ** 14
		i = 1
		while i ** 2 <= n:
			a = i
			cur = a - 1 + (n + a - 1) // a
			ans = min(ans, cur - 1)
			a = n // i
			cur = a - 1 + (n + a - 1) // a
			ans = min(ans, cur - 1)
			i += 1
		print(ans)
main()


import os
import sys
import math

def get_int():
	return int(input())

def get_ints():
	return map(int, input().split())

def get_float():
	return float(input())

def get_floats():
	return map(float, input().split())

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

def list_floats():
	return list(map(float, input.split()))

def post(x):
	print(x, end=' ')
T = int(input())
for t in range(1, T + 1):
	n = get_int()
	z = int(math.sqrt(n))
	ans = sys.maxsize
	for i in range(-5, 6):
		z2 = z - i
		if z2 > n or z2 < 1:
			continue
		ans = min(ans, z2 - 2 + (n + z2 - 1) // z2)
	print(ans)


from math import sqrt, ceil
d = {1: 0, 2: 1, 3: 2}
for _ in range(int(input())):
	n = int(input())
	if n in [1, 2, 3]:
		print(d[n])
		continue
	add = ceil(sqrt(n))
	mul = ceil(n / add)
	print(add + mul - 2)


def solve(n):
	ans = 10 ** 9
	x = 1
	while x * x <= n:
		ans = min(ans, x - 1 + (n - x + x - 1) // x)
		x += 1
	return ans
for _ in range(int(input())):
	n = int(input())
	print(solve(n))


import math
t = int(input())
for i in range(t):
	n = int(input())
	x = math.sqrt(n)
	if x % 1 < 0.5 and x % 1 > 0:
		print(math.floor(x) * 2 - 1)
	elif x % 1 >= 0.5:
		print(math.floor(x) * 2)
	else:
		print(math.floor(x) * 2 - 2)


from math import sqrt, floor, ceil
for _ in range(int(input())):
	N = int(input())
	root = sqrt(N)
	if root % 1 == 0:
		root = int(root)
		print(root - 1 + (root - 1))
	else:
		ceill = ceil(root)
		floorr = floor(root)
		x = ceill - 1 + ceil(N / ceill)
		y = floorr - 1 + ceil(N / floorr)
		print(min(x, y) - 1)


import math

def increaseAndCopy(n):
	if n == 1:
		return 0
	p = math.ceil(math.sqrt(n))
	minOperations = float('inf')
	for x in range(max(1, p - 5), p + 5):
		operations = x - 1 + math.ceil((n - x) / x)
		if operations < minOperations:
			minOperations = operations
	return minOperations
t = int(input())
final = []
for _ in range(t):
	final.append(increaseAndCopy(int(input())))
for _ in range(t):
	print(final[_])


import math
testcases = int(input())
for tc in range(testcases):
	value = int(input())
	calc = math.ceil(math.sqrt(value))
	vidpid = -2
	vidpid += int(calc) + int(value / calc)
	if int(calc) * int(value / calc) < value:
		print(vidpid + 1)
	else:
		print(vidpid)


import math
t = int(input())
while t > 0:
	n = int(input())
	x = round(math.sqrt(n))
	if n == 1:
		print(0)
	elif x * x >= n:
		print(x + x - 2)
	else:
		print(x + x - 1)
	t -= 1


import math
case = int(input())
for i in range(case):
	n = int(input())
	if (math.sqrt(n) // 1) ** 2 == n:
		print(int(2 * math.sqrt(n)) - 2)
	else:
		print(int(2 * math.sqrt(n)) - 1)


import math
from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	n = int(input())
	k = int(math.ceil(n ** 0.5))
	t = (n + k - 1) // k - 1
	print(k + t - 1)


import sys
import math
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	q = math.sqrt(n)
	r = q - 1 + math.ceil((n - q) / q)
	print(round(r))


from sys import stdin
from math import sqrt, floor
n = int(stdin.readline())
for case in range(n):
	goal = int(stdin.readline())
	flag = True
	start = int(sqrt(goal))
	cur = start
	while cur + 1 + floor(goal / (cur + 1)) <= cur + floor(goal / cur):
		if cur * floor(goal / cur) == goal:
			flag = False
			print(cur + floor(goal / cur) - 2)
			break
		cur += 1
	if flag:
		print(cur + floor(goal / cur) - 1)


import math
tests = int(input())
for testnum in range(tests):
	n = int(input())
	if n == 1:
		print(0)
	else:
		middle = int(math.floor(math.sqrt(n)))
		val = 0
		val += middle - 1
		val += int(math.ceil(n / middle)) - 1
		print(val)


t = int(input())
for j in range(t):
	n = int(input())
	ans = float('inf')
	for i in range(1, int(n ** 0.5) + 2):
		ans = min(ans, i - 1 + (n + i - 1) // i - 1)
	print(ans)


T = int(input())

def copy(N):
	Max = 1
	Min = n
	while Max * Max <= N:
		Min = min(Min, Max - 1 + N // Max - 1 + min(1, N % Max))
		Max += 1
	return Min
for i in range(T):
	n = int(input())
	print(copy(n))


def chk(x):
	t = (x + 1) // 2 + 1
	a = t * (t - 1) if x % 2 else t * t
	return a >= n
for _ in range(int(input())):
	n = int(input())
	(l, r) = (-1, n + 1)
	while r > l + 1:
		mid = (l + r) // 2
		if chk(mid):
			r = mid
		else:
			l = mid
	print(r)


from math import ceil
for t in range(int(input())):
	n = int(input())
	d = 1
	while d * (d + 1) < n:
		d = d + 1
	print(ceil(n / d) + d - 1 - 1)


import math
for _ in range(int(input())):
	n = int(input())
	a = int(math.sqrt(n))
	if a * a >= n:
		print(2 * a - 2)
	elif (a + 1) * a >= n:
		print(2 * a - 1)
	else:
		print(2 * a)


from math import *
t = int(input())
for _ in range(t):
	n = int(input())
	s = sqrt(4 * n - 1)
	s = floor(s - 1)
	print(s)


import math
t = int(input())
for _ in range(t):
	n = int(input())
	p = math.floor(n ** 0.5)
	q = math.ceil(n ** 0.5)
	x = p - 1 + math.ceil(n / p) - 1
	y = q - 1 + math.ceil(n / q) - 1
	print(min(x, y))


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	x = int(input())
	xx = int(x ** (1 / 2))
	ans = []
	ans.append(xx + (x - xx) // xx + bool((x - xx) % xx))
	xx += 1
	ans.append(xx + (x - xx) // xx + bool((x - xx) % xx))
	print(int(min(ans)) - 1)


import logging
import sys
from inspect import currentframe
input = sys.stdin.readline
logging.basicConfig(level=logging.DEBUG)

def dbg(*args):
	id2names = {id(v): k for (k, v) in currentframe().f_back.f_locals.items()}
	logging.debug(', '.join((id2names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args)))

def solve():
	n = int(input())
	ans = float('inf')
	x = 1
	while x * x <= n:
		cand = x - 1 + (n - x + x - 1) // x
		ans = min(ans, cand)
		x += 1
	print(ans)

def main():
	t = int(input())
	for _ in range(t):
		solve()
main()


import math

def get_int():
	return int(input())

def get_ints():
	return [int(i) for i in input().split()]
for t in range(0, get_int()):
	n = get_int()
	if n <= 1:
		print(0)
		continue
	m = n
	sq = int(math.sqrt(n))
	if sq * sq == m:
		print(sq - 1 + sq - 1)
	elif (1 + sq) * sq >= n:
		print(sq + sq - 1)
	else:
		print(sq + sq)


import math
t = int(input())
for _ in range(t):
	n = int(input())
	s = int(n ** 0.5)
	cands = list(range(max(0, s - 100), s + 100))
	ans = min((x + math.ceil(n / (x + 1)) - 1 for x in cands))
	print(ans)


import math
t = int(input())
for i in range(t):
	n = int(input())
	if n == 1:
		print(0)
	else:
		(i, d) = divmod(math.sqrt(n), 1)
		if d == 0:
			print(int((math.sqrt(n) * 2 - 2) // 1))
		else:
			print(int((math.sqrt(n) * 2 - 1) // 1))


import math
n = input()
lista = []

def upper_bound(x):
	if x - 0.5 >= int(x):
		return True
	return False
for x in range(int(n)):
	lista.append(input())
for x in lista:
	if int(x) == 1:
		print(0)
	else:
		num = math.sqrt(int(x))
		if upper_bound(num):
			num = int(num) + 1
		else:
			num = int(num)
		mosse = num - 1
		appoggio = num
		num = num * num
		mosse *= 2
		if num < int(x):
			num += appoggio
			mosse += 1
		print(mosse)


import math
t = int(input())

def solve():
	n = int(input())
	if n == 1:
		print(0)
		return
	s = int(math.ceil(n ** 0.5))
	print(int(math.ceil(n / s)) - 1 + s - 1)
for i in range(t):
	solve()


def calc(n):
	if n == 0:
		return 1
	elif n % 2 == 0:
		return (n // 2 + 1) * (n // 2 + 1)
	else:
		return max((n - n // 2 + 1) * (n // 2 + 1), (n - n // 2) * (n // 2 + 2))

def binsearch(n):
	low = 0
	high = 70000
	while low < high:
		mid = (low + high) // 2
		if calc(mid) >= n:
			high = mid
		else:
			low = mid + 1
	return high
t = int(input())
for _ in range(t):
	n = int(input())
	print(binsearch(n))


from math import *
from bisect import *
from collections import *
from random import *
from decimal import *
import sys
input = sys.stdin.readline

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

def st():
	return input().rstrip('\n')

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

def ma():
	return map(int, input().split())
t = inp()
while t:
	t -= 1
	n = inp()
	print(ceil((pow(n, 0.5) - 1) * 2))


import math

def fx(n):
	return math.floor(n / 2) * math.ceil(n / 2)
t = int(input())
for _ in range(t):
	n = int(input())
	st = 0
	en = 63247
	while st < en:
		mid = st + (en - st) // 2
		if fx(mid) >= n:
			en = mid
		else:
			st = mid + 1
	print(st - 2)


import math
n = int(input())
while n:
	x = int(input())
	y = int(math.sqrt(x))
	if y * y == x:
		print((y - 1) * 2)
	elif y * (y + 1) >= x:
		print(y * 2 - 1)
	else:
		print(y * 2)
	n -= 1


import math
import sys
t = int(sys.stdin.readline().strip())
for _ in range(t):
	n = int(sys.stdin.readline().strip())
	a = int(math.sqrt(n))
	(q, r) = (n // a, n % a)
	ans = a - 1 + q
	if r == 0:
		ans -= 1
	print(ans)


t = int(input())
arr = ''
for _ in range(t):
	n = int(input())
	minSteps = n - 1
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			steps = i - 2 + n // i
		else:
			steps = i - 1 + n // i
		minSteps = min(steps, minSteps)
	arr = arr + str(minSteps) + '\n'
print(arr[:-1])


import math
for _ in range(int(input())):
	num = int(input())
	sqrt = int(num ** 0.5)
	if num == 1:
		print(0)
	elif num == 2:
		print(1)
	elif num == 3:
		print(2)
	else:
		ans = 10 ** 9
		for i in range(sqrt - 1, sqrt + 2):
			ans = min(ans, int((num - 1) / i + i - 1))
		print(ans)


import sys
sys.setrecursionlimit(10000000)
mod = 10 ** 9 + 7
INF = float('inf')
from sys import stdin
readline = stdin.readline

def readInts():
	return list(map(int, readline().split()))

def readTuples():
	return tuple(map(int, readline().split()))

def I():
	return int(readline())
q = I()
import math
for _ in range(q):
	n = I()
	if n == 1:
		print(0)
		continue
	else:
		ans = INF
		i = int(math.sqrt(n))
		if n % i == 0:
			ans = min(ans, i - 2 + n // i)
		else:
			ans = min(ans, i - 2 + n // i + 1)
		print(ans)


import math
inf = float('inf')
mod = 10 ** 9 + 7
for _ in range(int(input())):
	n = int(input())
	if n <= 3:
		print(n - 1)
	else:
		ans = 10 ** 9
		for x in range(max(int(n ** 0.5) - 100, 1), int(n ** 0.5) + 100):
			req = x - 1 + math.ceil((n - x) / x)
			ans = min(ans, req)
		print(int(ans))


import sys
for i in range(0, int(sys.stdin.readline())):
	n = int(sys.stdin.readline())
	x = 1.0

	def ceil(x):
		for i in range(int(x - 1), int(x + 2)):
			if i >= x:
				return i
	while x - 1 + n / (x + 1) < x - 2 + n / x:
		x += 1.0
	sys.stdout.write(str(ceil(x - 2 + n / x)))
	sys.stdout.write('\n')


for t in range(int(input())):
	n = int(input())
	p = n - 1
	for i in range(2, int(n ** 0.5 + 1)):
		m = (n + i - 1) // i - 1
		q = i - 1 + m
		if q < p:
			p = q
	print(p)


from sys import stdin
import math

def get_int():
	return int(stdin.readline())

def get_str():
	return stdin.readline().strip()

def get_ints():
	return map(int, stdin.readline().strip().split())

def get_array():
	return list(map(int, stdin.readline().strip().split()))

def get_array2d(row):
	return [list(map(int, stdin.readline().strip().split())) for _ in range(row)]
T = get_int()
for _ in range(T):
	N = get_int()
	sqrN = math.ceil(N ** (1 / 2))
	ans = 0
	if sqrN * (sqrN - 1) >= N and sqrN * sqrN > N:
		ans = sqrN - 1 + (sqrN - 2)
	elif sqrN * sqrN >= N and sqrN * (sqrN + 1) > N:
		ans = (sqrN - 1) * 2
	else:
		ans = sqrN + (sqrN - 1)
	print(ans)


import math
t = int(input())
while t > 0:
	n = int(input())
	x = int(math.sqrt(n))
	res = 2 * (x - 1)
	k = n - x ** 2
	res += k // x
	if k % x != 0:
		res += 1
	print(res)
	t -= 1


import sys
try:
	(sys.stdin, sys.stdout) = (open('in.txt', 'r'), open('out.txt', 'w'))
except:
	pass
ii1 = lambda : int(sys.stdin.readline().strip())
is1 = lambda : sys.stdin.readline().strip()
iia = lambda : list(map(int, sys.stdin.readline().strip().split()))
isa = lambda : sys.stdin.readline().strip().split()
mod = int(1000000000.0 + 7)
from collections import *
from math import *
t = int(input())
for i in range(t):
	n = int(input())
	print(ceil((n ** 0.5 - 1) * 2))


import math
for t in range(int(input())):
	n = int(input())
	root = math.sqrt(n)
	root = math.ceil(root)
	count = root - 1
	count1 = math.ceil(n / root)
	count += count1
	print(count - 1)


for _ in range(int(input())):
	n = int(input())
	kk = int(pow(n, 0.5)) + 1
	if (kk - 1) ** 2 == n:
		kk -= 1
	tt = n // kk
	if n % kk == 0:
		print(kk + tt - 2)
	else:
		print(kk + tt - 1)


def solve(n):
	i = 1
	ans = 1e+18
	while i * i <= n:
		ans = min(ans, i - 2 + (n + i - 1) // i)
		i += 1
	return ans

def main():
	_t = int(input())
	for _ in range(_t):
		inp = int(input())
		print(solve(inp))
	return
main()


for _ in range(int(input())):
	n = int(input())
	mini = float('inf')
	for i in range(max(1, int(n ** 0.5) - 5), int(n ** 0.5) + 6):
		mini = min(mini, -(-n // i) + i)
	print(mini - 2)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	m = int(n ** 0.5)
	ans = 10 ** 9
	for i in range(m - 20, m + 20):
		if i >= 1:
			tmp = i - 1 + (n - 1) // i
			ans = min(ans, tmp)
	print(ans)


t = int(input())
for j in range(t):
	n = int(input())
	r = int(n ** (1 / 2))
	print(2 * (r - 1) + (n - r ** 2 + r - 1) // r)


from math import ceil
t = int(input())
for _ in range(t):
	n = int(input())
	steps = 0
	rt = ceil(n ** 0.5)
	steps += rt - 1
	if n % rt == 0:
		steps += n // rt - 1
	else:
		steps += n // rt
	print(steps)


import math
t = int(input())
ans = []
for i in range(t):
	a = int(input())
	tmp = 0
	if 1 <= a <= 3:
		tmp = a - 1
		ans.append(tmp)
		continue
	tmq = math.floor(math.sqrt(a))
	tsq = tmq ** 2
	tmp = 2 * tmq - 2
	while tsq < a:
		tsq += tmq
		tmp += 1
	ans.append(tmp)
print(*ans, sep='\n')


import math
t = input()
t = int(t)

def solve(n):
	if n == 1:
		print(0)
		return
	ans = float('inf')
	for x in range(max(1, math.ceil(math.sqrt(n)) - 10), math.ceil(math.sqrt(n)) + 10):
		tmp = math.ceil(n / (x + 1)) - 1 + x
		if ans > tmp:
			ans = tmp
	print(ans)
for i in range(t):
	n = input()
	n = int(n)
	solve(n)


from sys import *
from math import *
t = int(stdin.readline())
for _ in range(t):
	n = int(stdin.readline())
	ans = n
	s = 1
	for i in range(1, int(sqrt(n)) + 1):
		x = i - 1
		y = n // i - 1
		if n % i == 0:
			z = 0
		else:
			z = 1
		if x + y + z < ans:
			ans = x + y + z
	print(ans)


tt = int(input())
for _ in range(tt):
	n = int(input())
	if n == 1:
		print(0)
	else:
		t = 1
		while t * t <= n:
			t += 1
		t -= 1
		ans = n // t
		k = t + ans
		if n % t:
			print(k - 1)
		else:
			print(k - 2)


import os
import sys
from io import BytesIO, IOBase
import threading
from collections import defaultdict, Counter
from math import factorial as fac
from math import sqrt, ceil

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		sqrtn = sqrt(n)
		sqrtn = int(sqrtn)
		ans = 1000000000.0
		for i in range(1, sqrtn + 7):
			val = i - 1 + (n - i) // i
			val += 1 if (n - i) % i > 0 else 0
			ans = min(ans, val)
		print(ans)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush, nsmallest
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
from decimal import Decimal
from types import GeneratorType
mod = pow(10, 9) + 7

def data():
	return sys.stdin.readline().strip()

def out(var):
	sys.stdout.write(str(var) + '\n')

def outa(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
moves = [1, 2]
cnt = 0
temp = 2
while True:
	moves.append(moves[-1] + temp)
	cnt += 1
	if cnt == 2:
		temp += 1
		cnt = 0
	if moves[-1] >= mod:
		break
for _ in range(int(data())):
	n = int(data())
	temp = bl(moves, n)
	if moves[temp] < n:
		temp += 1
	out(temp)


from sys import stdin, stdout
input = stdin.readline
from collections import defaultdict as dd
import math

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

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

def gets():
	return input()

def geta():
	return int(input())

def print_s(s):
	stdout.write(s + '\n')

def solve():
	for _ in range(geta()):
		n = geta()
		ans = float('inf')
		for i in range(math.ceil(math.sqrt(n)), 0, -1):
			prod1 = i * (n // i)
			prod2 = i * ((n - 1) // i + 1)
			temp1 = i - 1 + (n // i - 1)
			temp2 = i - 1 + n // i
			if prod2 < n:
				temp2 += n - prod2
			if temp1 == 0:
				temp1 = n - 1
			elif n - prod1 > 0:
				temp1 += n - prod1
			if temp1 > ans and temp2 > ans:
				break
			ans = min(ans, temp1, temp2)
		print(ans)
solve()


t = int(input())
for tt in range(t):
	n = int(input())
	if n == 1:
		print(0)
		continue
	a = int(n ** 0.5)
	i = a - 1 + n // a
	if n % a == 0:
		i -= 1
	print(i)


import sys
input = sys.stdin.readline

def getInts():
	return [int(s) for s in input().split()]

def getInt():
	return int(input())

def getStrs():
	return [s for s in input().split()]

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

def listStr():
	return list(input().strip())
import collections as col
import math, itertools

def solve():
	N = getInt()
	best = 10 ** 9
	for j in range(1, int(N ** 0.5) + 1):
		best = min(best, N // j + j - 1 - (N % j == 0))
	return best
for _ in range(getInt()):
	print(solve())


from math import sqrt
fn = lambda b, n: n / (1 + b) + (1 + b) - 2

def main():
	caseNum = int(input())
	for _ in range(caseNum):
		n = int(input())
		if n == 1:
			print(0)
			continue
		tmp = sqrt(n)
		b = int(tmp - 1)
		if b + 1 == tmp:
			print(f'{int(fn(b, n)):d}')
		else:
			(lNum, rNum) = (fn(b, n), fn(b + 1, n))
			result = max([lNum, rNum])
			if result == int(result):
				print(f'{int(result):d}')
			else:
				print(f'{int(result) + 1:d}')
main()


from math import ceil, pow, floor
for _ in range(int(input())):
	n = int(input())
	base = pow(n, 0.5)
	ans = floor(base) - 1 + ceil(n / floor(base))
	ans = min(ans, ceil(base) - 1 + ceil(n / ceil(base)))
	print(ans - 1)


from math import *
for u in range(int(input())):
	n = int(input())
	ka = int(sqrt(n))
	if ka * ka == n:
		print(2 * (ka - 1))
	elif ka * (ka + 1) >= n:
		print(2 * ka - 1)
	else:
		print(2 * ka)


from math import ceil, floor
for _ in range(int(input())):
	n = int(input())
	ans = float('inf')
	upper = ceil(n ** 0.5 + 1)
	upper_ = ceil(n / 2) + 1
	for i in range(1, upper):
		moves = floor(i - 1 + (n - 1) / i)
		ans = min(ans, moves)
	print(ans)


import math
strr = input()
strr = int(strr)
for i in range(strr):
	st = input()
	st = int(st)
	tmp2 = round(float(st / math.sqrt(st)))
	tmp3 = round(float(math.sqrt(st)))
	if tmp3 != 1:
		tmp3 = tmp3 - 1
	if st / math.sqrt(st) - tmp2 < 1e-05:
		tmp2 = tmp2 - 1
	tmp = tmp3 + tmp2
	tmp = int(tmp)
	if st == 1:
		tmp = 0
	if st == 2:
		tmp = 1
	print(tmp)


import sys
import math
import itertools
import functools
import collections
import operator
import fileinput
import copy
ORDA = 97

def ii():
	return int(input())

def mi():
	return map(int, input().split())

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

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=2):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	new_number = 0
	while number > 0:
		new_number += number % base
		number //= base
	return new_number

def cdiv(n, k):
	return n // k + (n % k != 0)

def ispal(s):
	for i in range(len(s) // 2 + 1):
		if s[i] != s[-i - 1]:
			return False
	return True

def main():
	for i in range(ii()):
		n = ii()
		s = int(n ** 0.5)
		if n % s == 0:
			print(n // s - 1 + s - 1)
		else:
			print(n // s + s - 1)
main()


import math
for T in range(int(input())):
	n = int(input())
	l = int(0)
	r = n
	while l + 1 < r:
		mid = (l + r) // 2
		if mid * mid < n:
			l = mid
		else:
			r = mid
	print(r + math.ceil(n / r) - 2)


import math
t = int(input())
for w in range(t):
	n = int(input())
	c = int(math.sqrt(n))
	m = n - 1
	for i in range(max(2, c - 5), min(n, c + 5)):
		m = min(i - 1 + math.ceil((n - i) / i), m)
	print(m)


import math
t = int(input())
for _ in range(t):
	n = int(input())
	if n == 1:
		print(0)
		continue
	elif n == 2:
		print(1)
		continue
	ans = n
	k = n
	for d in range(int(n ** 0.5), int(n ** 0.5) + 4):
		curr_ans = n // d
		if n % d != 0:
			curr_ans += 1
		curr_ans += d - 2
		if curr_ans < ans:
			ans = curr_ans
			k = d
	print(ans)


import sys
import re
import random
import math
import copy
from heapq import heappush, heappop, heapify
from functools import cmp_to_key
from bisect import bisect_left, bisect_right
from collections import defaultdict, deque, Counter
input = sys.stdin.readline
getS = lambda : input().strip()
getN = lambda : int(input())
getList = lambda : list(map(int, input().split()))
getZList = lambda : [int(x) - 1 for x in input().split()]
INF = float('inf')
MOD = 10 ** 9 + 7
divide = lambda x: pow(x, MOD - 2, MOD)

def solve():
	n = getN()
	ans = INF
	ss = int(math.sqrt(n))
	for i in range(max(1, ss - 100), ss + 100):
		if i > n:
			break
		tmp = i + (n - 1) // i + 1 - 2
		ans = min(ans, tmp)
	print(ans)

def main():
	n = getN()
	for _ in range(n):
		solve()
	return
main()


def solve():
	n = int(input())
	b = int(pow(n, 0.5))
	if b * b >= n:
		print(2 * (b - 1))
		return
	if b * (b + 1) >= n:
		print(2 * b - 1)
		return
	if (b + 1) * (b + 1) >= n:
		print(2 * b)
tc = int(input())
while tc > 0:
	solve()
	tc -= 1


import math
t = int(input())
for you in range(t):
	n = int(input())
	z = int(math.sqrt(n))
	l = [z - 1, z - 2, z, z + 1, z + 2]
	mina = 10 ** 18
	for i in l:
		if i > 0:
			mina = min(mina, i + (n + i - 1) // i - 2)
	print(mina)


import math
for i in range(int(input())):
	n = int(input())
	a = math.floor(math.sqrt(n))
	l = a - 1
	if n % a == 0:
		l = l + n // a - 1
	else:
		l = l + n // a
	print(l)


from math import ceil
t = int(input())
outs = []
n = 0

def formula(a):
	global n
	if a == 0:
		return 0
	return a - 1 + ceil((n - a) / a)
for tt in range(t):
	n = int(input())
	out = n - 1
	(l, r) = (1, n)
	while True:
		i = l + ceil((r - l) / 2)
		il = i - 1
		ir = i + 1
		while formula(il) == formula(i) and il > 1:
			il -= 1
		while formula(ir) == formula(i) and ir < n:
			ir += 1
		if formula(il) < formula(i):
			r = il
		elif formula(ir) < formula(i):
			l = ir
		else:
			outs.append(formula(i))
			break
for o in outs:
	print(o)


import math
for _ in range(int(input())):
	n = int(input())
	x = math.ceil(math.sqrt(n))
	y = math.ceil(n / x)
	print(x + y - 2)


import math
for i in range(int(input())):
	n = int(input())
	if n == 1:
		print(0)
	elif n == 2:
		print(1)
	else:
		r = int(math.sqrt(n))
		q = math.ceil(n / r)
		print(r - 2 + q)


from math import sqrt
for _ in range(int(input())):
	n = int(input())
	sq = int(sqrt(n))
	a = sq
	b = sq
	if a * b < n:
		b += 1
		if a * b < n:
			a += 1
	(mx1, mx2) = (a, b)
	ans = mx1 + mx2 - 2
	print(ans)


import math
t = 1
t = int(input())
while t:
	t -= 1
	n = int(input())
	i = max(1, int(n ** 0.5))
	ans = math.ceil((n - i) / i) + i - 1
	i -= 1
	i = max(1, i)
	temp = math.ceil((n - i) / i) + i - 1
	ans = min(ans, temp)
	i += 2
	temp = math.ceil((n - i) / i) + i - 1
	ans = min(ans, temp)
	print(ans)


import sys
input = sys.stdin.readline

def main():
	n = int(input())
	k = int(n ** 0.5)
	n -= k ** 2
	ans = 2 * (k - 1) + 1
	if n > k:
		ans += 1
	if n == 0:
		ans -= 1
	print(ans)
for _ in range(int(input())):
	main()


from math import *
from bisect import bisect_left as bl
from bisect import bisect_right as br
from collections import Counter as ctr
from collections import deque as dq
from array import array
inp = lambda : int(input())
li = lambda : list(map(int, input().split()))
lb = lambda : list(map(int, input()))
ls = lambda : list(input())
bi = lambda n: bin(n).replace('0b', '')
yn = lambda f: print('NYOE S'[f::2])

def solve(__=1):
	for _ in range(__):
		n = inp()
		if n == 1:
			print(0)
		elif n == 2:
			print(1)
		else:
			t = ceil(sqrt(n))
			print(t + (t if t * (t - 1) < n else t - 1) - 2)
solve(inp())


import math
for _ in range(int(input())):
	n = int(input())
	m = 1000000000
	for i in range(1, int(math.sqrt(n) + 1)):
		p = n - i
		q = p // i
		r = p % i
		ans = i - 1 + q
		if r > 0:
			ans += 1
		if ans < m:
			m = ans
	print(m)


import math
for i in range(int(input())):
	n = int(input())
	st = int(math.sqrt(n))
	mi = n
	for x in range(max(0, st - 100), st + 100):
		cur = (n + x) // (x + 1) + x - 1
		mi = min(cur, mi)
	print(mi)


import math
for _ in range(int(input())):
	s = int(input())
	a = [1]
	p = math.floor(math.sqrt(s))
	c = math.ceil(s / p)
	print(p + c - 2)


import sys
import os
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
mod = 10 ** 9 + 7

def lcm(x, y):
	return x * y / gcd(x, y)

def fact(x, mod=mod):
	ans = 1
	for i in range(1, x + 1):
		ans = ans * i % mod
	return ans

def arr2D(n, m, default=0):
	lst = []
	for i in range(n):
		temp = [default] * m
		lst.append(temp)
	return lst

def sortDictV(x):
	return {k: v for (k, v) in sorted(x.items(), key=lambda item: item[1])}
from math import ceil

def solve(n):
	cnt = ceil(n ** 0.5)
	time = ceil(n / cnt)
	return cnt + time - 2
for _ in range(int(input())):
	n = int(input())
	print(solve(n))


import math
for i in range(0, int(input())):
	n = int(input())
	x1 = math.floor(pow(n, 0.5)) - 1
	x2 = math.ceil(pow(n, 0.5)) - 1
	if (x1 + 1) * (x2 + 1) < n:
		x2 += 1
	print(x1 + x2)


def ceildiv(a, b):
	if a % b == 0:
		return a // b
	else:
		return a // b + 1

def solve():
	n = int(input())
	l = 0
	r = n - 1
	if n == 1:
		print(0)
		return
	while l < r:
		m = l + (r - l) // 2
		if m < ceildiv(n - m - 1, m + 1):
			l = m + 1
		else:
			r = m
	b = l - 1
	ans = min(b + ceildiv(n - b - 1, b + 1), l + ceildiv(n - l - 1, l + 1))
	print(ans)
t = int(input())
for _ in range(t):
	solve()


import math

def main():
	s = 0
	n = int(input())
	if n == 1:
		return print(0)
	root = n ** 0.5
	(l, h) = (math.floor(root), math.ceil(root))
	if l * h < n:
		l += 1
	print(l - 1 + h - 1)
for i in range(int(input())):
	main()


import math

def inc_double(n):
	n -= 1
	ans = int(math.sqrt(4 * n + 1)) - 1
	return ans
t = int(input())
for i in range(t):
	n = int(input())
	print(inc_double(n))


import io
import os
from collections import Counter, defaultdict, deque

def solve(N):
	best = float('inf')
	for x in range(int(N ** 0.5) - 10, int(N ** 0.5) + 10):
		if x < 0:
			continue
		y = N // (x + 1)
		if N % (x + 1) != 0:
			y += 1
		y -= 1
		assert (x + 1) * (y + 1) >= N
		best = min(best, x + y)
	return best
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
TC = int(input())
for tc in range(1, TC + 1):
	(N,) = [int(x) for x in input().split()]
	ans = solve(N)
	print(ans)


import sys, math
from collections import Counter, deque, defaultdict
from bisect import bisect_left, bisect_right
mod = 10 ** 9 + 7
INF = float('inf')

def inp():
	return int(sys.stdin.readline())

def inpl():
	return list(map(int, sys.stdin.readline().split()))
for _ in range(inp()):
	n = inp()
	res = INF
	for x in range(1, 31600):
		now = (n + x - 1) // x + x - 2
		res = min(res, now)
	print(res)


from math import sqrt, ceil
t = int(input())
for i in range(t):
	n = int(input())
	sqrt_n = int(sqrt(n))
	ans = []
	for i in range(2):
		sqrt_n += i
		ans.append(sqrt_n - 1 + ceil((n - sqrt_n) / sqrt_n))
	print(min(ans))


import sys
import math

def sq_root(n):
	low = 1
	high = n
	while low < high:
		mid = low + (high - low) // 2
		if mid * mid >= n:
			high = mid
		else:
			low = mid + 1
	if n == 1:
		ans = 0
	else:
		ans = 2 * low - 2
	return ans

def prod_two(n):
	low = 1
	high = n
	while low < high:
		mid = low + (high - low) // 2
		if mid * (mid + 1) >= n:
			high = mid
		else:
			low = mid + 1
	if n == 1:
		ans = 0
	else:
		ans = 2 * low - 1
	return ans
t = int(sys.stdin.readline())
ans_arr = []
for i in range(t):
	n = int(sys.stdin.readline())
	ans = min(prod_two(n), sq_root(n))
	ans_arr.append(str(ans))
print('\n'.join(ans_arr))


import math
t = int(input())
for _ in range(t):
	n = int(input())
	sq = math.ceil(math.sqrt(n))
	mi = n - 1
	for t in range(max(sq - 10, 1), sq + 10):
		mi = min(t - 1 + (n - t + t - 1) // t, mi)
	print(mi)


import math
import sys
t = int(input())
for cs in range(t):
	n = int(input())
	x = int(math.ceil(math.sqrt(n)))
	print(x + (n + x - 1) // x - 2)


from math import ceil

def main(array_sum):
	best_moves_number = 10 ** 10
	for i in range(1, ceil(array_sum / 2) + 1):
		current_moves_number = i - 1 + array_sum // i
		if array_sum % i != 0:
			current_moves_number += 1
		if current_moves_number < best_moves_number:
			best_moves_number = current_moves_number
		elif best_moves_number < current_moves_number:
			break
	return best_moves_number - 1
tt = int(input())
for _ in range(tt):
	array_sum = int(input())
	print(main(array_sum))


import math
t = int(input())
while t:
	ans = 10000000000.0
	n = int(input())
	times = math.ceil(int(math.sqrt(n)))
	for i in range(1, times + 1):
		x = n // i + i - 1
		if n % i == 0:
			x -= 1
		ans = min(ans, x)
	print(ans)
	t -= 1


from math import ceil
t = int(input())
values = []
for i in range(t):
	values.append(int(input()))
	values[i] = ceil((values[i] ** 0.5 - 1) * 2)
for i in range(t):
	print(values[i])


a = int(input())
from math import sqrt
for i in range(a):
	b = int(input())
	g = int(sqrt(b))
	if b != 1:
		ans = g - 1
		if b % g == 0:
			ans += b // g - 1
		else:
			ans += b // g
		print(ans)
	else:
		print(0)


from math import *
for _ in range(int(input())):
	n = int(input())
	ans = 0
	while ans + (n - 1) // (ans + 1) >= ans + 1 + (n - 1) // (ans + 2):
		ans += 1
	print(ans + (n - 1) // (ans + 1))


from collections import defaultdict
import bisect
from math import ceil
for _ in range(int(input())):
	n = int(input())
	x = ceil(n ** 0.5)
	ans = x + x
	if (x - 1) * (x - 1) >= n:
		ans = 2 * x - 2
	elif x * (x - 1) >= n:
		ans = 2 * x - 1
	print(ans - 2)


import sys
import os
from math import sqrt, log, log2, log10, gcd, floor, pow, sin, cos, tan, pi, inf, factorial
from copy import copy, deepcopy
import bisect
from sys import exit, stdin, stdout
from collections import Counter, defaultdict, deque
from itertools import permutations
import heapq
mod = 1000000007
iinp = lambda : int(sys.stdin.readline())
inp = lambda : sys.stdin.readline().strip()
strl = lambda : list(inp().strip().split(' '))
intl = lambda : list(map(int, inp().split(' ')))
mint = lambda : map(int, inp().split())
flol = lambda : list(map(float, inp().split(' ')))
flush = lambda : stdout.flush()

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	p = int(sqrt(n))
	for i in range(5, p + 1, 6):
		if n % i == 0 or n % (i + 2) == 0:
			return False
	return True

def solve():
	n = iinp()
	root = int(sqrt(n))
	if root * root >= n:
		print(2 * root - 2)
	elif root * (root + 1) >= n:
		print(2 * root - 1)
	else:
		print(2 * root)
for _ in range(iinp()):
	solve()


for t in range(int(input())):
	n = int(input())
	print(int(n ** 0.5) - 2 + n // int(n ** 0.5) + int(n % int(n ** 0.5) != 0))


import math
t = int(input())
for i in range(t):
	n = int(input())
	a = math.sqrt(n)
	b = int(a)
	x = 2 * b - 1
	if a != b:
		c = n - b ** 2
		if c <= b:
			x += 1
		else:
			x += 2
	print(x - 1)


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from heapq import *
from math import gcd, factorial, floor, ceil
from copy import deepcopy
from collections import deque
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func
mod = 10 ** 9 + 7

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for pp in range(t):
		solve(pp)

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def google(p):
	print('Case #' + str(p) + ': ', end='')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def solve(case):
	n = int(inp())
	temp = floor(n ** 0.5)
	ans = n // temp + temp - 1
	print(ans - 1 if n % temp == 0 else ans)
testcase(int(inp()))


import math

def main():
	n = int(input())
	if n < 4:
		print(n - 1)
	else:
		x = math.sqrt(n)
		y = int(x)
		if y * y == n:
			print(y + y - 2)
		elif y * (y + 1) >= n:
			print(y + y + 1 - 2)
		else:
			print(2 * y + 2 - 2)
tn = int(input())
for _ in range(tn):
	main()


import math
t = int(input())
for i in range(t):
	n = int(input())
	x = math.ceil(n ** 0.5)
	if (x - 1) * x < n:
		print(2 * x - 2)
	else:
		print(2 * x - 3)


import math
t = int(input())
while t:
	a = int(input())
	print(math.ceil((math.sqrt(a) - 1) * 2))
	t = t - 1


import math

def ans1(n, k):
	r = (n + k - 1) // k - 1
	return k - 1 + r

def ans(n):
	t = n + 1
	if n == 1:
		return 0
	if n == 2:
		return 1
	if n < 300:
		for i in range(1, n + 1):
			t = min(t, ans1(n, i))
		return t
	else:
		y = int(math.sqrt(n))
		for i in range(max(1, y - 100), y + 100):
			t = min(t, ans1(n, i))
		return t
for i in range(int(input())):
	n = int(input())
	print(ans(n))


from math import ceil
t = int(input())
for i in range(t):
	n = int(input())
	asdf = ceil(n ** 0.5)
	print(asdf - 1 + (n + asdf - 1) // asdf - 1)


import math

def floornum():
	t = int(input())
	for i in range(t):
		n = int(input())
		m = math.ceil(n ** 0.5)
		l = math.ceil(n / m)
		if n == 1:
			print('0', end='\n')
		else:
			print(m + l - 2, end='\n')
floornum()


from math import sqrt, ceil
for _ in range(int(input())):
	n = int(input())
	p = ceil(sqrt(n))
	s = p - 1
	if p * (p - 1) >= n:
		s += p - 2
	else:
		s += p - 1
	print(s)


import sys

def solve(key):
	global n
	list_n = [key, key]
	now = 0
	while n > list_n[0] * list_n[1]:
		list_n[now] += 1
		now = not now
	return list_n
T = int(sys.stdin.readline())
for _ in range(T):
	n = int(sys.stdin.readline())
	key = int(n ** 0.5)
	print(sum(solve(key)) - 2)


from math import sqrt, ceil
for I in range(int(input())):
	n = int(input())
	mini = 1000000000000
	num = -1
	it = int(sqrt(n)) + 1
	for i in range(it, max(0, it - 5), -1):
		cost = i - 1
		temp = n - i
		rem = ceil(temp / i)
		tot = cost + rem
		mini = min(mini, tot)
	print(mini)


import math
import sys
t = int(sys.stdin.readline())

def check(x):
	return x ** 2
for _ in range(t):
	n = int(sys.stdin.readline())
	l = 0
	r = n
	while l <= r:
		mid = (l + r) // 2
		if check(mid) <= n:
			l = mid + 1
		else:
			r = mid - 1
	if r == 0:
		print(0)
	else:
		print((r - 1) * 2 + math.ceil((n - r * r) / r))


t = int(input())
for _ in range(t):
	n = int(input())
	if n == 1:
		print(0)
	else:
		a = int(n ** 0.5)
		if (n - a) % a == 0:
			print((n - a) // a + a - 1)
		else:
			print((n - a) // a + a)


import math
for _ in range(int(input())):
	val = int(input())
	if val == 1:
		print(0)
	else:
		s = math.ceil(math.sqrt(val - 1))
		nxt = (val - 1) // s
		psst = val - 1 - s * nxt
		grt = (val - psst - s - 1) // s
		print(int(psst + (s - psst) + grt))


from math import sqrt
test_cases = int(input())
for t in range(test_cases):
	n = int(input())
	sqr = int(sqrt(n))
	ans = n - 1
	for x in range(sqr - 50, sqr + 50):
		if x > 0:
			ans = min(ans, x - 1 + (n + x - 1) / x - 1)
	print(int(ans))


import math

def solve(n):
	r = math.sqrt(n)
	if int(r) * int(r) == n:
		x = math.sqrt(n) - 1
		return int(2 * x)
	else:
		x = r - 1
		y = r
		return int(x + y)
t = int(input())
for _ in range(t):
	n = int(input())
	print(solve(n))


from math import sqrt
t = int(input())
for _ in range(t):
	n = int(input())
	if n < 2:
		print(0)
	else:
		a = b = int(sqrt(n)) - 1
		temp = 1
		while (a + 1) * b < n and a * (b + 1) < n:
			a += temp
			b += 1 - temp
			temp = 1 - temp
		print(a + b - 1)


for s in [*open(0)][1:]:
	n = m = int(s)
	d = int(n ** 0.5)
	l = d - 6 if d > 6 else 1
	r = d + 6
	for i in range(l, r):
		m = min(i + (n - i + i - 1) / i - 1, m)
	print(int(m))


T = int(input())
ans_ls = [float('inf')] * T
for t in range(T):
	N = int(input())
	ans = float('inf')
	for base in range(1, int(N ** 0.5) + 1):
		times = -(-N // base)
		ans = min(ans, times + (base - 1) - 1)
	ans = min(ans, N)
	ans_ls[t] = ans
for ans in ans_ls:
	print(ans)


from math import ceil, sqrt
for _ in range(int(input())):
	n = int(input())
	ans = 1000000000.0
	root_n = int(sqrt(n)) + 1
	for i in range(-5, 6):
		x = root_n + i
		if x < 1 or x > n:
			continue
		ans = min(ans, x - 1 + ceil((n - x) / x))
	print(ans)


import math
for _ in range(int(input())):
	n = int(input())
	if n == 1:
		print(0)
	else:
		x = math.sqrt(n)
		(a, b) = (int(x), math.ceil(x))
		if n % int(x) == 0:
			x = int(x)
			print(x - 1 + n // x - 1)
		else:
			print(round(x - 1 + n // x))


from math import *
a = int(input())
for x in range(a):
	b = int(input())
	c = ceil(sqrt(b))
	d = ceil((b - c) / c)
	e = d + c - 1
	print(e)


import sys
import math as mt
import bisect
input = sys.stdin.readline
t = int(input())

def ncr_util():
	inv[0] = inv[1] = 1
	fact[0] = fact[1] = 1
	for i in range(2, 300001):
		inv[i] = inv[i % p] * (p - p // i) % p
	for i in range(1, 300001):
		inv[i] = inv[i - 1] * inv[i] % p
		fact[i] = fact[i - 1] * i % p

def solve():
	if n == 1:
		return 0
	i = 2
	ans = 1 + (n - 2) // 2 + (n - 2) % 2
	while i * i <= n:
		x = 0
		if (n - i) % i != 0:
			x += 1
		ans = min(i - 1 + (n - i) // i + x, ans)
		i += 1
	return ans
for _ in range(t):
	n = int(input())
	print(solve())


from math import *
N = list(map(int, open(0).read().split()))
for n in N[1:]:
	print(int(ceil(n ** 0.5) + ceil(n / ceil(n ** 0.5)) - 2))


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log2, ceil, pi, sin, cos, acos, atan
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
from bisect import insort
from collections import Counter
from collections import deque
from heapq import heappush, heappop, heapify
from itertools import permutations, combinations
mod = int(1000000000.0) + 7
mod2 = 998244353
ip = lambda : int(stdin.readline())
inp = lambda : map(int, stdin.readline().split())
ips = lambda : stdin.readline().rstrip()
out = lambda x: stdout.write(str(x) + '\n')
t = ip()
for _ in range(t):
	n = ip()
	sq = ceil(sqrt(n))
	ans = sq - 1
	ans += ceil(n / sq)
	out(ans - 1)


import math
for j in range(int(input())):
	f = int(input())
	u = int(f ** 0.5)
	g = 0
	for k in range(u - 5, u + 6):
		if k >= 1:
			v = k - 1 + math.ceil((f - k) / k)
			if g == 0:
				ans = v
				g += 1
			else:
				ans = min(v, ans)
	print(ans)


import sys
import math as m

def result(n):
	return (1 + m.floor(n / 2)) * (1 + m.ceil(n / 2))

def solve(start, end):
	mid = int((start + end) / 2)
	res = result(mid)
	if mid == start:
		return start
	if res == n:
		return mid
	elif res < n:
		return solve(mid, end)
	else:
		return solve(start, mid)
t = int(input())
for tc in range(t):
	n = int(input())
	if n == 1:
		print(0)
		continue
	ans = solve(1, n)
	if result(ans) >= n:
		print(ans)
	else:
		print(ans + 1)


import math
for i in range(int(input())):
	n = int(input())
	sq = math.floor(math.sqrt(n))
	no = sq - 1
	no += math.ceil((n - sq) / sq)
	print(no)


t = int(input())
for _ in range(t):
	n = int(input())
	k = int(n ** 0.5)
	print(k - 1 + (n + k - 1) // k - 1)


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

def solve(n):
	cur_max = 1
	for i in range(10 ** 6):
		if num_of_actions(n - cur_max - 1, cur_max + 1) <= num_of_actions(n - cur_max, cur_max) - 1:
			cur_max += 1
		else:
			return cur_max + num_of_actions(n - cur_max, cur_max) - 1

def num_of_actions(need, cur_max):
	return (need + cur_max - 1) // cur_max
t = int(input())
for _ in range(t):
	n = int(input())
	print(solve(n))


import math
for _ in '0' * int(input()):
	n = int(input())
	print(int(math.sqrt(n) - 1) + (n // int(math.sqrt(n)) - [0, 1][n % int(math.sqrt(n)) == 0]))


import math
t = int(input())
for _ in range(t):
	n = int(input())
	sqrt_n = math.floor(math.sqrt(n))
	print(min((n - 1) // sqrt_n + (sqrt_n - 1), (n - 1) // (sqrt_n + 1) + sqrt_n))


t = int(input())
for j in range(0, t):
	n = int(input())
	c = 0
	r = 0
	if n == 1:
		print(0)
	else:
		ty = int(n ** 0.5)
		c = ty - 1
		ty1 = int(n ** 0.5) + 1
		r = ty1 - 1
		if n % ty == 0:
			c = c + n // ty - 1
		else:
			c = c + n // ty
		if n % ty1 == 0:
			r = r + n // ty1 - 1
		else:
			r = r + n // ty1
		print(min(r, c))


import math
t = int(input())
while t > 0:
	n = int(input())
	mid = int(math.sqrt(n))
	res = n
	for i in range(max(1, mid - 5), min(n, mid + 5) + 1):
		rem = n % i
		tot = i - 1 + n // i - 1
		if rem > 0:
			tot += 1
		res = min(res, tot)
	print(res)
	t -= 1


import sys
from collections import defaultdict as dd
from collections import Counter as cc
from queue import Queue
import math
import itertools
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
input = lambda : sys.stdin.buffer.readline().rstrip()
for _ in range(int(input())):
	n = int(input())
	if n == 1:
		print(0)
		continue
	q = math.sqrt(n)
	if int(q) != q:
		q = int(q)
	else:
		q = int(q) - 1
	w = n / (q + 1)
	if int(w) != w:
		w = int(w)
	else:
		w = int(w) - 1
	print(q + w)


import math
for _ in range(int(input())):
	n = int(input())
	if n <= 1:
		print(0)
	else:
		x = math.ceil(n ** 0.5)
		move = x - 1
		if x * (x - 1) >= n:
			ans = move + x - 2
		else:
			ans = move + x - 1
		print(ans)


def ceildiv(a, b):
	return a // b + (0 if a % b == 0 else 1)

def f(n, k):
	return k + ceildiv(n, k + 1) - 1

def solve(n):
	isqrt = int(n ** 0.5)
	return min([f(n, k) for k in range(isqrt - 20, isqrt + 20) if k >= 0])
for _ in range(int(input())):
	print(solve(int(input())))


from math import ceil, floor
t = int(input())
for i in range(0, t):
	n = int(input())
	a = floor(n ** 0.5)
	res = a - 1 + floor(n / a) - 1
	if n % (floor(n / a) * a) == 0:
		print(res)
	else:
		print(res + 1)


import sys
import math
input = sys.stdin.readline
t = int(input())
for i in range(t):
	n = int(input())
	s = math.sqrt(n)
	res = (math.ceil(s) - 1) * 2
	(a, b) = (math.ceil(s), math.floor(s))
	if a * b >= n:
		res = a + b - 2
	(a, b) = (math.floor(s), math.floor(s))
	if a * b >= n:
		res = a + b - 2
	print(res)


from bisect import bisect_left
mmax = 10 ** 9
v = int(mmax ** 0.5) + 1
f = {}
flag = 0
for i in range(1, v + 1):
	if i * i >= mmax:
		if flag == 0:
			f[mmax] = 2 * i - 2
			flag = 1
	else:
		f[i * i] = 2 * i - 2
	if i * (i + 1) >= mmax:
		if flag == 0:
			f[mmax] = 2 * i - 1
			flag = 1
	else:
		f[i * (i + 1)] = 2 * i - 1
m = sorted(f.keys())
cases = int(input())
for t in range(cases):
	n = int(input())
	pos = bisect_left(m, n)
	print(f[m[pos]])


from bisect import bisect_left, bisect_right
import os
import sys
from io import BytesIO, IOBase
from collections import Counter
from collections import deque, defaultdict
import math
import heapq
import re

def sin():
	return input()

def ain():
	return list(map(int, sin().split()))

def sain():
	return input().split()

def iin():
	return int(sin())
LOW = 'abcdefghijklmnopqrstuvwxyz'
UP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
MAX = float('inf')
MIN = float('-inf')
MOD = 998244353

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def main():
	for _ in range(iin()):
		n = iin()
		root = math.floor(n ** 0.5)
		if root * root >= n:
			print(2 * root - 2)
		elif (root + 1) * root >= n:
			print(2 * root - 1)
		else:
			print(2 * root)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
if os.getcwd() == 'D:\\code':
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
	input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


from math import *
for i in range(int(input())):
	n = int(input())
	print(trunc(2 * sqrt(n) - 1e-12) - 1)


t = int(input())
import math as m
for test in range(1, t + 1):
	n = int(input())
	x = int(n ** 0.5) - 1
	y = m.ceil(n / (x + 1))
	print(x + y - 1)


from math import *
for _ in range(int(input())):
	n = int(input())
	sq = floor(sqrt(n))
	if sq * sq >= n:
		print(2 * sq - 2)
	elif (sq + 1) * sq >= n:
		print(2 * sq - 1)
	else:
		print(2 * sq)


for _ in range(int(input())):
	n = int(input())
	mini = n
	for i in range(2, int(n ** 0.5) + 2):
		mi = 0
		p = i - 1
		k = i
		if n // i == n / i:
			mi += n // i
		else:
			mi += n // i
			mi += 1
		mi += p
		if mi < mini:
			mini = mi
	print(mini - 1)


import math
import bisect
from math import gcd, floor, sqrt, log
from collections import defaultdict as dd
from collections import Counter
I = lambda : int(input())
tup = lambda : map(int, input().split())
lst = lambda : list(map(int, input().split()))
t = I()
while t:
	n = I()
	ans = 10 ** 9
	for x in range(1, int(sqrt(n)) + 1):
		ans = min(ans, x - 1 + (n - x + x - 1) / x)
	print(int(ans))
	t -= 1


import math

def readis():
	return map(int, input().strip().split())
T = int(input())
while T:
	T -= 1
	n = int(input())
	min_nmov = n - 1
	max_x = math.sqrt(n)
	x = 1
	while x <= max_x:
		x += 1
		min_nmov = min(min_nmov, x - 1 + (n - 1) // x)
	print(min_nmov)


import math
tsts = int(input())
for i in range(tsts):
	sm = int(input())
	inc = math.floor(math.sqrt(sm))
	mul = sm // inc
	if inc * mul >= sm:
		print(inc + mul - 2)
	else:
		print(inc + mul - 1)


t = int(input())
for _ in range(t):
	n = int(input())
	ans = 10 ** 18
	for k in range(int(n ** 0.5) + 100):
		moves = k + (n + k) // (k + 1) - 1
		ans = min(ans, moves)
	print(ans)


import math
for i in range(int(input())):
	commands = 0
	k = 2
	x = int(input())
	if x == 1:
		print(0)
	else:
		k = int(math.sqrt(x))
		commands += k - 2
		commands += int(x / k)
		if k * int(x / k) < x:
			commands += 1
		print(commands)


import math

def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		a = int(math.sqrt(n))
		print(a - 1 + math.ceil((n - a) / a))
	return 0
main()


from functools import reduce
import os
import sys
from collections import *
from math import *
from bisect import *
from heapq import *
from io import BytesIO, IOBase
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return tuple(map(int, input().split()))

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

def sarr():
	return [int(i) for i in input()]

def starr():
	return [str(x) for x in input().split()]

def inn():
	return int(input())

def svalue():
	return tuple(map(str, input().split()))

def parr():
	return [value() for i in range(2 * n)]
mo = 1000000007
inf = 1e+18
div = 998244353

def factors(n):
	return list(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))
for _ in range(inn()):
	n = inn()
	res = factors(n)
	ans = inf
	val = int(n ** 0.5) + 4
	for i in range(1, val):
		res = i - 1 + n // i
		if n % i == 0:
			res -= 1
		ans = min(ans, res)
	print(ans)


from math import sqrt, ceil

def solve():
	n = int(input())
	k = int(ceil(sqrt(n)))
	moves = k - 2 + (n + k - 1) // k
	print(moves)
	return

def main():
	t = 1
	t = int(input())
	for _ in range(t):
		solve()
main()


from sys import stdin, stdout
import math, sys, heapq
from itertools import permutations, combinations
from collections import defaultdict, deque, OrderedDict
from os import path
import random
import bisect as bi

def yes():
	print('YES')

def no():
	print('NO')
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

	def I():
		return int(input())

	def In():
		return map(int, input().split())
else:

	def I():
		return int(stdin.readline())

	def In():
		return map(int, stdin.readline().split())

def dict(a):
	d = {}
	for x in a:
		if d.get(x, -1) != -1:
			d[x] += 1
		else:
			d[x] = 1
	return d

def find_gt(a, x):
	i = bi.bisect_left(a, x)
	if i != len(a):
		return i
	else:
		return -1

def cal(n):
	return n * (n + 1) // 2

def main():
	try:
		n = I()
		ans = 100000000.0
		for i in range(1, int(n ** 0.5) + 1):
			ans = min(ans, i - 1 + math.floor((n - i + i - 1) / i))
		print(ans)
	except:
		pass
M = 998244353
P = 1000000007
for _ in range(I()):
	main()


from math import floor
for i in range(int(input())):
	n = int(input())
	if n == 1:
		print(0)
	else:
		sqrt = floor(n ** (1 / 2))
		copias = n // sqrt
		if n % sqrt == 0:
			copias -= 1
		ans = sqrt + copias - 1
		print(ans)


import itertools
import math
import sys
from collections import defaultdict

def stdinWrapper():
	data = '5\n1\n5\n42\n1337\n1000000000\n\n\n\n'
	for line in data.split('\n'):
		yield line
if '--debug' not in sys.argv:

	def stdinWrapper():
		while True:
			yield sys.stdin.readline()
inputs = stdinWrapper()

def inputWrapper():
	return next(inputs)

def getType(_type):
	return _type(inputWrapper())

def getArray(_type):
	return [_type(x) for x in inputWrapper().split()]

def tuplerize(method):

	def wrap(*args, **kwargs):
		res = method(*args, **kwargs)
		if res is not tuple and res is not list:
			res = (res,)
		return res
	return wrap

@tuplerize
def solve(n):
	sqrt = math.floor(math.sqrt(n))
	other = (n + sqrt - 1) // sqrt
	return sqrt + other - 2
t = getType(int)
for _ in range(t):
	n = getType(int)
	res = solve(n)
	print(*res)


TC = int(input())
for __ in range(TC):
	n = int(input())
	ans = n
	for x in range(1, n):
		if x * x > n:
			break
		ans = min(ans, x - 1 + (n + x - 1) // x)
	print(ans - 1)


import sys
import math
from operator import itemgetter, attrgetter, methodcaller
input = sys.stdin.readline
ttt = int(input())
for tt in range(ttt):
	n = int(input())
	ans = float('inf')
	if n < 1000:
		for k in range(1, n + 1):
			ans = min(ans, k - 1 + (n - 1) // k)
	else:
		sq = int(math.sqrt(n))
		for k in range(sq - 10, sq + 11):
			ans = min(ans, k - 1 + (n - 1) // k)
	if n == 1:
		print(0)
		continue
	if n == 2:
		print(1)
		continue
	if n == 3:
		print(2)
		continue
	print(ans)


rn = lambda : int(input())
rns = lambda : map(int, input().split())
rl = lambda : list(map(int, input().split()))
rs = lambda : input()
yn = lambda x: print('Yes') if x else print('No')
for _ in range(rn()):
	n = rn()

	def solve(n):
		if n == 1:
			return 0
		from math import ceil
		a = ceil(n ** 0.5)
		ans = a - 1 + ceil(n / a) - 1
		return ans
	print(solve(n))


import sys

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c for j in range(b)] for i in range(a)]

def list3d(a, b, c, d):
	return [[[d for k in range(c)] for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e for l in range(d)] for k in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 19
MOD = 10 ** 9 + 7
EPS = 10 ** (-10)
for _ in range(INT()):
	N = INT()
	if N <= 1:
		print(0)
	elif N <= 2:
		print(1)
	else:
		cur = 2
		add = 2
		cnt = 1
		while cur < N:
			cur += add
			cnt += 1
			if cnt % 2 == 1:
				add += 1
		print(cnt)


import math
for _ in range(int(input())):
	n = int(input())
	x = math.pow(n, 0.5)
	ans = 0
	ans += x - 1
	extra = (n - x) / x
	if extra == int(extra):
		ans += extra
	else:
		ans += extra + 1
	print(int(ans))


import sys
from math import sqrt, gcd, ceil, log, floor
from bisect import bisect, bisect_left
from collections import defaultdict, Counter, deque
from heapq import heapify, heappush, heappop
input = sys.stdin.readline
read = lambda : list(map(int, input().strip().split()))
MOD = 998244353

def f(n):
	s = int(sqrt(n))
	if s ** 2 == n:
		return 2 * s - 2
	for i in range(s + 1, s + 3):
		if s * i >= n:
			return i - 1 + s - 1

def main():
	ans = []
	for _ in range(int(input())):
		ans.append(f(int(input())))
	print('\n'.join(map(str, ans)))
main()


import math
for _ in range(int(input())):
	n = int(input())
	c = 0
	p = pow(n, 1 / 2)
	n -= 1
	ans = 1000000000.0
	for i in range(1, int(p + 6)):
		c = 0
		c += i
		c += (n - i) // i
		ans = min(ans, c)
	print(ans)


import math
for test in range(int(input())):
	n = int(input())
	x = math.floor(n ** (1 / 2))
	y = math.ceil(n / x)
	print(y + x - 2)


import sys
import math
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	temp = int(math.sqrt(n))
	print(temp + ((n + temp - 1) // temp - 2))


t = int(input())
for i in range(t):
	s = 1
	x = 0
	l = 1
	n = int(input())
	while x * x < n:
		x += 1
	if x == 1:
		print(0)
	else:
		print((n - 1) // x + x - 1)


a = [1, 2]
x = 2
while a[-1] < 1000000000:
	a.append(x * x)
	a.append(x * x + x)
	x += 1
for _ in range(int(input())):
	n = int(input())
	x = 0
	while a[x] < n:
		x += 1
	print(x)


from math import ceil
for _ in range(int(input())):
	n = int(input())
	ans1 = int(n ** 0.5)
	ans2 = ceil(n ** 0.5)
	ans = min(ceil((n - ans1) / ans1) + ans1, ceil((n - ans2) / ans2) + ans2)
	print(ans - 1)


import math
t = int(input())
for i in range(t):
	n = int(input())
	if n == 1:
		print(0)
	else:
		a = math.floor(math.sqrt(n))
		b = a + 1
		s1 = a - 1
		s2 = b - 1
		left1 = n - a
		left2 = n - b
		s1 += math.ceil(left1 / a)
		s2 += math.ceil(left2 / b)
		print(min(s1, s2))


from math import sqrt
for _ in range(int(input())):
	n = int(input())
	if n == 1:
		print(0)
	elif n == 2:
		print(1)
	else:
		x = int(sqrt(n))
		y = n / x
		result = x + int(y) - 2
		if int(y) != y:
			result += 1
		print(result)


import os
from sys import stdin, stdout

class Input:

	def __init__(self):
		self.lines = stdin.readlines()
		self.idx = 0

	def line(self):
		try:
			return self.lines[self.idx].strip()
		finally:
			self.idx += 1

	def array(self, sep=' ', cast=int):
		return list(map(cast, self.line().split(sep=sep)))

	def has_next(self):
		return self.idx < len(self.lines)

def known_cases(func):
	inpt = Input()
	(cases,) = inpt.array()
	for case in range(cases):
		func(inpt)

def unknown_cases(func):
	inpt = Input()
	while inpt.has_next():
		func(inpt)
import math

@known_cases
def solve(inpt):
	(n,) = inpt.array()
	a = int(math.sqrt(n))
	b = (n + a - 1) // a
	print(a + b - 2)


from math import sqrt, ceil
T = int(input())
for t in range(T):
	n = int(input())
	r = int(sqrt(n))
	ans = r - 1
	ans += ceil(n / r) - 1
	print(ans)


import math
t = int(input())
while t > 0:
	n = int(input())
	a = int(math.sqrt(n))
	if a * a >= n:
		print(2 * a - 2)
	elif (a + 1) * a >= n:
		print(2 * a - 1)
	else:
		print(2 * a)
	t = t - 1


import sys
inp = sys.stdin.buffer.readline
inar = lambda : list(map(int, inp().split()))
inin = lambda : int(inp())
inst = lambda : inp().decode().strip()
wrt = sys.stdout.write
pr = lambda *args, end='\n': wrt(' '.join([str(x) for x in args]) + end)
enum = enumerate
inf = float('inf')
cdiv = lambda x, y: -(-x // y)
_T_ = inin()
for _t_ in range(_T_):
	n = inin()
	ans = inf
	for i in range(1, int(n ** 0.5) + 1):
		x = i
		ans = min(ans, x - 1 + cdiv(n - x, x))
	if ans == inf:
		pr(0)
	else:
		pr(ans)


from math import *
from pprint import *
from sys import *
from collections import *
from itertools import *
from functools import *
from random import *

def getl(t=int):
	return [t(x) for x in input().split()]

def get(t=int):
	return t(input())
alphabet = [chr(x) for x in range(ord('a'), ord('z') + 1)]
alnum = lambda x: ord(x) - ord('a')

def main():
	for i in range(get()):
		print(solve(get()))

def solve(n):
	x = -1
	b = int(100000000.0)
	while b >= 1:
		while maxsum(x + b) < n:
			x += b
		b //= 2
	return x + 1

def maxsum(n):
	return (1 + n // 2) * (1 + (n + 1) // 2)
main()


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def si():
	return input()

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

def msi():
	return map(str, input().strip().split(' '))

def li():
	return list(mi())

def dmain():
	sys.setrecursionlimit(1000000)
	threading.stack_size(1024000)
	thread = threading.Thread(target=main)
	thread.start()
import sys
input = sys.stdin.readline
scanner = lambda : int(input())
string = lambda : input().rstrip()
get_list = lambda : list(read())
read = lambda : map(int, input().split())
get_float = lambda : map(float, input().split())

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

def factorial(x, m):
	val = 1
	while x > 0:
		val = val * x % m
		x -= 1
	return val

def fact(x):
	val = 1
	while x > 0:
		val *= x
		x -= 1
	return val

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	return a * b // math.gcd(a, b)

def is_integer(n):
	return math.ceil(n) == math.floor(n)

def nCr(n, k):
	if k > n:
		return 0
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	(prime[0], prime[1]) = (False, False)
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def phi(n):
	result = n
	p = 2
	while p * p <= n:
		if n % p == 0:
			while n % p == 0:
				n = n // p
			result = result * (1.0 - 1.0 / float(p))
		p = p + 1
	if n > 1:
		result = result * (1.0 - 1.0 / float(n))
	return int(result)

def is_prime(n):
	if n == 0:
		return False
	if n == 1:
		return True
	for i in range(2, int(n ** (1 / 2)) + 1):
		if not n % i:
			return False
	return True

def next_prime(n, primes):
	while primes[n] != True:
		n += 1
	return n
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i
spf = [0 for i in range(MAXN)]

def factoriazation(x):
	res = []
	for i in range(2, int(x ** 0.5) + 1):
		while x % i == 0:
			res.append(i)
			x //= i
	if x != 1:
		res.append(x)
	return res

def factors(n):
	res = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			res.append(i)
			res.append(n // i)
	return list(set(res))

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

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

def str_array():
	return input().strip().split()

def binary_search(low, high, w, h, n):
	while low < high:
		mid = low + (high - low) // 2
		if check(mid, w, h, n):
			low = mid + 1
		else:
			high = mid
	return low

def check(moves, n):
	val = (moves + 1) // 2
	rem = moves - val
	sol = (val + 1) * (rem + 1)
	return sol < n

def sortSecond(val):
	return val[1]
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
alphs = 'abcdefghijklmnopqrstuvwxyz'
from itertools import permutations
import math
import bisect as bis
import random
import sys
import collections as collect
import functools as fnt

def solve():
	n = scanner()
	high = n
	low = 0
	while low < high:
		mid = low + (high - low) // 2
		if check(mid, n):
			low = mid + 1
		else:
			high = mid
	print(low)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
t = scanner()
for i in range(t):
	solve()


t = int(input())
for _ in range(t):
	ans = 10000000000
	n = int(input())
	for i in range(1, int(n ** 0.5) + 1):
		ans = min(ans, i - 1 + (n - 1) // i)
	print(ans)


import math

def ceil(a, b):
	return (a + b - 1) // b

def calc(n, a):
	return a - 1 + ceil(n - a, a)

def solve():
	n = int(input())
	i = int(math.sqrt(n))
	ans = n - 1
	ans = min(ans, calc(n, i))
	ans = min(ans, calc(n, i + 1))
	print(ans)
t = 1
t = int(input())
for _ in range(0, t):
	solve()


from sys import stdin, stdout
from collections import deque
import bisect
R = lambda : stdin.readline().strip()
RL = lambda f=None: list(map(f, R().split(' '))) if f else list(R().split(' '))
output = lambda x: stdout.write(str(x) + '\n')
output_list = lambda x: output(' '.join(map(str, x)))
import math
T = int(input())
ma = 10 ** 5
for _ in range(T):
	n = int(R())
	if n == 1:
		print(0)
		continue
	root = math.floor(math.sqrt(n))
	ans = root - 1
	ans += math.ceil(n / root)
	print(int(ans - 1))


import math
for t in range(int(input())):
	n = int(input())
	index = int(math.sqrt(n))
	if n > index * (index + 1):
		print(index * 2)
	elif n > index * index:
		print(index * 2 - 1)
	else:
		print(index * 2 - 2)


from math import sqrt
for _ in [0] * int(input()):
	n = int(input())
	d = sqrt(n)
	if d == int(d):
		print(int(2 * d - 2))
	else:
		print(int(2 * d) - 1)


import math
for _ in range(int(input())):
	n = int(input())
	m = math.sqrt(n)
	c = math.ceil((m - 1) * 2)
	print(c)


for test in range(int(input())):
	n = int(input())
	done = 0
	k = 1
	current = 0
	while True:
		done += k
		if done >= n:
			print(current)
			break
		done += k
		if done >= n:
			print(current + 1)
			break
		current += 2
		k += 1


t = int(input())
for q in range(t):
	n = int(input())
	root = int(n ** 0.5)
	if root ** 2 >= n:
		print(2 * root - 2)
	elif (root + 1) * root >= n:
		print(2 * root - 2 + 1)
	else:
		print(2 * root)


import math
for i in range(int(input())):
	n = int(input())
	ans = 99999999999999999999
	r = math.sqrt(n) + 1
	for a in range(1, int(r)):
		b = n // a
		ta = 0
		if a * b != n:
			ta = 1
		ta += min(a, b) - 1 + max(a, b) - 1
		ans = min(ans, ta)
	print(ans)


import math
for _ in range(int(input())):
	n = int(input())
	if n == 1:
		print(0)
		continue
	temp = math.sqrt(n)
	if isinstance(temp, int):
		temp = int(temp)
		print(temp + (temp - 2))
	else:
		temp = int(temp)
		temp2 = n - temp * temp
		if temp2 % temp == 0:
			print(temp - 1 + (temp - 1) + temp2 // temp)
		else:
			print(temp - 1 + (temp - 1) + temp2 // temp + 1)


import math
for _ in range(int(input())):
	n = int(input())
	x = int(math.sqrt(n))
	if x * x == n:
		print(int(2 * math.sqrt(n) - 2))
	else:
		print(int(2 * math.sqrt(n) - 1))


import math
for aww in range(int(input())):
	n = int(input())
	a = [1]
	i = n ** 0.5
	x = n / i + (i - 1)
	print(math.ceil(x - 1))


import math

def isPerfectSquare(x):
	sr = math.sqrt(x)
	return sr - math.floor(sr) == 0
for _ in range(int(input())):
	n = int(input())
	ans = math.sqrt(n) * 2 - 1
	if isPerfectSquare(n):
		ans = ans - 1
	print(int(ans))


import sys, threading
import math
from collections import defaultdict, Counter
input = sys.stdin.readline

def rl(type):
	return [type(w) for w in input().split()]

def reverse(arr):
	return arr[-1::-1]

def mod(a, m):
	return (a % m + m) % m

def check_prime(n):
	temp = int(math.sqrt(n) + 1)
	for i in range(2, temp):
		if n % i == 0:
			return False
	return True

def create_graph(n):
	graph = {}
	for _ in range(n):
		(x, y) = map(int, input().split())
		graph[x].append(y)
		graph[y].append(x)
	return graph

def main():
	for _ in range(int(input())):
		n = int(input())
		if n == 1:
			print(0)
			continue
		sq = int(math.sqrt(n))
		mini = maxi = sq
		if sq * (sq + 1) <= n:
			temp = n - sq * (sq + 1)
			maxi = sq + 1
		else:
			temp = n - sq * sq
		if temp == 0:
			result = maxi + mini - 2
		else:
			result = temp - 1 + (maxi + 1 - temp) + (mini - 1)
		print(result)
sys.setrecursionlimit(10 ** 6)
threading.stack_size(10 ** 8)
t = threading.Thread(target=main)
t.start()
t.join()


import math
t = int(input())
for i in range(t):
	K = int(input())
	q = math.sqrt(K) - 1
	n1 = math.floor(q)
	n2 = math.ceil(q)
	c1 = math.ceil(K / (n1 + 1) - 1) + n1
	c2 = math.ceil(K / (n2 + 1) - 1) + n2
	print(min(c1, c2))


t = int(input())
for i in range(t):
	n = int(input())
	for steps in range(n + 1):
		result = int((steps / 2 + 1) * (steps - steps / 2 + 1))
		if result >= n:
			print(steps)
			break


t = int(input())
for u in range(t):
	n = int(input())
	x = int(n ** 0.5)
	print(x - 1 + (n - 1) // x)


t = int(input())
for _ in range(t):
	n = int(input())
	ans = int(n ** (1 / 2))
	ans += (n - ans) // ans + int(bool((n - ans) % ans))
	print(ans - 1)


from sys import stdin, stdout
from math import sqrt

def read_input():
	lines = []
	for line in stdin:
		if 'exit' == line.lower().rstrip():
			break
		lines.append(line.rstrip())
	return lines
data = read_input()
t = int(data[0])
for case in range(1, t + 1):
	n = int(data[case])
	a = int(sqrt(n))
	b = n - a
	if b % a == 0:
		b //= a
	else:
		b //= a
		b += 1
	b = b + a - 1
	stdout.write(str(b) + '\n')
stdout.flush()


import math

def task_C():
	t = int(input())
	for _ in range(t):
		n = int(input())
		sqrt_n = int(math.sqrt(n))
		addition = (n - sqrt_n ** 2 - 1) // sqrt_n
		print((sqrt_n - 1) * 2 + addition + 1)

def main():
	task_C()
main()


import time, math as mt, bisect as bs, sys
from sys import stdin, stdout
from collections import deque
from fractions import Fraction
from collections import Counter
from collections import OrderedDict
pi = 3.141592653589793

def II():
	return int(stdin.readline())

def IP():
	return map(int, stdin.readline().split())

def L():
	return list(map(int, stdin.readline().split()))

def P(x):
	return stdout.write(str(x) + '\n')

def PI(x, y):
	return stdout.write(str(x) + ' ' + str(y) + '\n')

def lcm(a, b):
	return a * b // gcd(a, b)

def gcd(a, b):
	if a == 0:
		return b
	elif b == 0:
		return a
	if a > b:
		return gcd(a % b, b)
	else:
		return gcd(a, b % a)

def bfs(adj, v):
	visited = [False] * (v + 1)
	q = deque()
	while q:
		pass

def sieve():
	li = [True] * (2 * 10 ** 5 + 5)
	(li[0], li[1]) = (False, False)
	for i in range(2, len(li), 1):
		if li[i] == True:
			for j in range(i * i, len(li), i):
				li[j] = False
	prime = []
	for i in range(2 * 10 ** 5 + 5):
		if li[i] == True:
			prime.append(i)
	return prime

def setBit(n):
	count = 0
	while n != 0:
		n = n & n - 1
		count += 1
	return count
mx = 10 ** 7
spf = [mx] * (mx + 1)

def SPF():
	spf[1] = 1
	for i in range(2, mx + 1):
		if spf[i] == mx:
			spf[i] = i
			for j in range(i * i, mx + 1, i):
				if i < spf[j]:
					spf[j] = i
	return

def readTree(n, e):
	adj = [set() for i in range(n + 1)]
	for i in range(e):
		(u1, u2) = IP()
		adj[u1].add(u2)
	return adj
mod = 10 ** 9 + 7

def solve():
	n = II()
	x = int(mt.sqrt(n))
	if n % x == 0:
		print(n // x + (x - 2))
	else:
		print(n // x + 1 + (x - 2))
	return
t = II()
for i in range(t):
	solve()


import math
for x in range(int(input())):
	n = int(input())
	k = math.ceil(math.sqrt(n))
	ans = k - 1
	ans += math.ceil(n / k) - 1
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	if n == 1:
		print(0)
		continue
	if n == 2:
		print(1)
		continue
	temp = 0
	for i in range(2, n):
		temp = i
		if i * i >= n:
			break
	check1 = i - 1 - 1 + n // (i - 1) - 1
	if n % (i - 1) != 0:
		check1 += 1
	check2 = i - 1 + n // i - 1
	if n % i != 0:
		check2 += 1
	print(min(check1, check2))


import math
t = int(input())
for i in range(t):
	a = int(input())
	ans = a
	x = int(math.sqrt(a)) + 2
	for i in range(1, x):
		n = a // i
		k = 0
		if a % i:
			k = 1
		else:
			k = 0
		ans = min(ans, n + i + k - 2)
	if a == 1:
		print(0)
	elif a == 2:
		print(1)
	else:
		print(ans)


import math

def stepcount(n):
	if n == 1:
		return 0
	cc = math.floor(n ** 0.5)
	c = n - cc * cc
	bonus = 0
	if c != 0:
		if c <= cc:
			bonus = 1
		else:
			bonus = 2
	return 2 * cc - 2 + bonus
t = int(input())
for i in range(t):
	print(stepcount(int(input())))


from collections import defaultdict, Counter
import copy, math
from copy import deepcopy
for _ in range(int(input())):
	n = int(input())
	j = 1
	s = 99999999999
	if n == 1:
		print(0)
	else:
		while j < n:
			j += 1
			if (n - j) % j == 0:
				s = min(s, j + (n - j) // j - 1)
				if s < j + (n - j) // j - 1:
					break
			else:
				s = min(s, j + (n - j) // j)
				if s < j + (n - j) // j:
					break
		print(s)


import sys, os, io

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

def ria():
	return list(map(int, sys.stdin.readline().split()))

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math, datetime, functools, itertools, operator, bisect, fractions
from collections import deque, defaultdict, OrderedDict, Counter
from fractions import Fraction
from decimal import Decimal

def main():
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	for _ in range(ri()):
		n = ri()
		steps = 0
		a = math.floor(math.sqrt(n))
		b = math.ceil(math.sqrt(n))
		z = [a * a, a * b, b * b]
		for i in range(3):
			if z[i] >= n:
				if i == 0:
					print((a - 1) * 2)
				if i == 1:
					print(a - 1 + (b - 1))
				if i == 2:
					print((b - 1) * 2)
				break
	endtime = datetime.datetime.now()
	time = (endtime - starttime).total_seconds() * 1000
	if os.path.exists('input.txt'):
		print('Time:', time, 'ms')

class FastReader(io.IOBase):
	newlines = 0

	def __init__(self, fd, chunk_size=1024 * 8):
		self._fd = fd
		self._chunk_size = chunk_size
		self.buffer = io.BytesIO()

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self, size=-1):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

class FastWriter(io.IOBase):

	def __init__(self, fd):
		self._fd = fd
		self.buffer = io.BytesIO()
		self.write = self.buffer.write

	def flush(self):
		os.write(self._fd, self.buffer.getvalue())
		(self.buffer.truncate(0), self.buffer.seek(0))

class FastStdin(io.IOBase):

	def __init__(self, fd=0):
		self.buffer = FastReader(fd)
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

class FastStdout(io.IOBase):

	def __init__(self, fd=1):
		self.buffer = FastWriter(fd)
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.flush = self.buffer.flush
sys.stdin = FastStdin()
sys.stdout = FastStdout()
main()


import sys
from itertools import permutations
from itertools import combinations
from itertools import combinations_with_replacement
for _ in range(int(input())):
	n = int(input())
	if n == 1:
		print('0')
		continue
	if n == 2:
		print('1')
		continue
	ans = 1
	toAdd = 2
	ctr = 0
	s = 2
	while s < n:
		s += toAdd
		ans += 1
		if ctr == 0:
			ctr = 1
		else:
			toAdd += 1
			ctr = 0
	print(ans)


from math import ceil
t = int(input())
for _ in range(t):
	n = int(input())
	if n == 1:
		print(0)
		continue
	ans = int(n ** 0.5)
	print(ans - 1 + ceil(n / ans) - 1)


import math
t = int(input())
cases = []
for i in range(t):
	n = int(input())
	cases.append(n)
for n in cases:
	lower = round(math.sqrt(n))
	upper = math.ceil(math.sqrt(n))
	total = upper + lower
	print(total - 2)


def main():
	for _ in range(int(input())):
		n = int(input())
		(l, r) = (0, n)
		ans = n
		while l <= r:
			m = (l + r) // 2
			if m % 2 == 1:
				k = m // 2
				t = k * (k + 1) // 2 + (k + 1) * (k + 2) // 2
				if t >= n:
					r = m - 1
					ans = m
				else:
					l = m + 1
			else:
				k = m // 2
				t = k * (k + 1)
				if t >= n:
					r = m - 1
					ans = m
				else:
					l = m + 1
		print(ans - 1 if n != 1 else 0)
main()


import math
test = int(input())
for k in range(test):
	n = int(input())
	print(math.ceil(n ** 0.5) - 1 + math.ceil(n / math.ceil(n ** 0.5)) - 1)


import math

def solve(n):
	while True:
		r = math.floor(math.sqrt(n))
		if r * r == n:
			return r + r - 2
		if r * (r + 1) == n:
			return r + r - 1
		n += 1

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		print(solve(n))
main()


for _ in range(int(input())):
	n = int(input())
	prev = 10000000000.0
	m = 1
	k = 0
	while m < 70000:
		if (n - m) % m == 0:
			k = (n - m) // m
		else:
			k = (n - m) // m + 1
		if m + k - 1 < prev:
			prev = m + k - 1
		m += 1
	print(str(prev))


import math
for _ in range(int(input())):
	n = int(input())
	t = n - 1
	for d in range(max(0, int(math.sqrt(n)) - 10), int(math.sqrt(n)) + 10):
		x = d + (n + d) // (d + 1) - 1
		t = min(t, x)
	print(t)


t = int(input())
for _ in range(t):
	n = int(input())
	if n == 1:
		print(0)
	else:
		c = n ** 0.5
		if c == int(c):
			print(int(2 * c - 2))
		else:
			print(int(2 * c - 1))


t = int(input())
ans = []
for k in range(t):
	n = int(input())
	mx = int(n ** 0.5) * 2 - 2
	if int(n ** 0.5) == n ** 0.5:
		ans.append(mx)
	else:
		mx += 1
		if (int(n ** 0.5) + 1) ** 2 - n < n - int(n ** 0.5) ** 2:
			mx += 1
		ans.append(mx)
print(*ans, sep='\n')


MOD = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
from collections import *
import math
for _ in range(ii()):
	n = ii()
	k = math.sqrt(n)
	k = math.ceil(k)
	m = n / k
	m = math.ceil(m)
	print(k - 1 + m - 1)


from collections import defaultdict
from sys import stdin
input = stdin.readline
import math

def put():
	return map(int, input().split())
t = int(input())
for _ in range(t):
	n = int(input())
	ans = math.sqrt(n)
	ans = math.ceil(2 * ans - 1)
	print(ans - 1)


from math import ceil, sqrt
T = int(input())

def solve(n):
	if n == 1:
		print('0')
		return
	sq = ceil(sqrt(n))
	moves = sq - 1
	rem = ceil(n / sq)
	print(moves + (rem - 1))
for _ in range(T):
	n = int(input())
	solve(n)


import math
t = int(input())
for _ in range(t):
	n = int(input())
	i = int(math.sqrt(n))
	ans = n
	if n % i == 0:
		ans = min(ans, n // i - 1 + (i - 1))
	else:
		ans = min(ans, n // i + (i - 1))
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	n1 = n ** 0.5
	n1 = int(n1)
	if n1 ** 2 < n:
		if n - n1 ** 2 > n1:
			result = 2 * n1
		else:
			result = n1 + (n1 - 1)
	else:
		result = n1 - 1 + (n1 - 1)
	print(result)