output_description: Print the minimum number of moves needed to reach a square that contains the
  integer N.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N
attempt: N = int(input())
  x = N
  y = N
  ansx = N
  ansy = N
  ans = []
  n = int(N**0.5)
  if N**0.5 == int(N**0.5):
      print(int(N**0.5))
  else:
      for i in range(n + 1):
          if N % (i + 1) == 0:
              ans.append(i + 1)
      ans.append(N)
      if ans[1] == N:
          print(N - 1)
      else:
          for i in range(len(ans)):
              if ansx > ans[i]:
                  if ansy > N // ans[i]:
                      ansx = ans[i]
                      ansy = int(N // ans[i])
          print(ansx + ansy - 2)
  
problem_description: Statement
  
  Takahashi is standing on a multiplication table with infinitely many rows and
  columns.
  
  The square (i,j) contains the integer i \times j. Initially, Takahashi is
  standing at (1,1).
  
  In one move, he can move from (i,j) to either (i+1,j) or (i,j+1).
  
  Given an integer N, find the minimum number of moves needed to reach a square
  that contains N.
samples: [{"input": "10", "output": "5\n    \n\n(2,5) can be reached in five moves. We cannot reach a square that contains 10\nin less than five moves.\n\n* * *"}, {"input": "50", "output": "13\n    \n\n(5, 10) can be reached in 13 moves.\n\n* * *"}, {"input": "10000000019", "output": "10000000018\n    \n\nBoth input and output may be enormous."}]