#include <bits/stdc++.h>
int main() {
  int N;
  std::cin >> N;
  long ans1 = 1, ans2 = N;
  long sum = ans1 + ans2 - 2;
  long i = 0;
  long j = 0;
  for (i = 0; i <= sqrt(N); i++) {
    for (j = 0; j <= sqrt(N); j++) {
      if (i * j - 2 == N) {
        sum = std::min(sum, i + j - 2);
      }
    }
  }
  std::cout << sum << std::endl;
  return N;
}
