n = int(eval(input()))

i = 1

ans = n

 

while i * i <= n:

    j, m = divmod(n, i)

    if m == 0:

        ans = min(ans, i + j - 2)

    i += 1

 

print(ans)
import numpy as np



n = int(eval(input()))



a = 1

b = n



ans = n - 1



for i in range(2, int(np.sqrt(n) + 1)):

    if n % i ==  0:

        a = int(i)

        b = int(n / i)

        ans = min(ans, int(a + b - 2))



print(ans)
n = int(eval(input()))
i = 1
ans = n
while i * i <= n:
    j, m = divmod(n, i)
    if m == 0:
        ans = min(ans, i + j - 2)
    i += 1
print(ans)

import numpy as np

n = int(eval(input()))
a = 1
b = n
ans = n - 1
for i in range(2, int(np.sqrt(n) + 1)):
    if n % i == 0:
        a = int(i)
        b = int(n / i)
        ans = min(ans, int(a + b - 2))
print(ans)

+import numpy as np + -i = 1 -ans = n -while i * i <= n: -    j, m = divmod(n, i) -    if m == 0: -        ans = min(ans, i + j - 2) -    i += 1 +a = 1 +b = n +ans = n - 1 +for i in range(2, int(np.sqrt(n) + 1)): +    if n % i == 0: +        a = int(i) +        b = int(n / i) +        ans = min(ans, int(a + b - 2))