#include <bits/stdc++.h>
int main() {
  uint64_t target;
  std::cin >> target;
  uint64_t sq_target = std::sqrt(target);
  uint64_t ans = std::numeric_limits<uint64_t>::max();
  for (uint64_t i = 1; i <= sq_target; ++i) {
    for (uint64_t j = i;; ++j) {
      if (i * j >= target) {
        if (i * j == target) ans = std::min(ans, (i + j - 2));
        break;
      }
    }
  }
  std::cout << ans << std::endl;
}
