#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= i; j++) {
      if (i * j == n) {
        cout << j - 1 + i - 1;
        return 0;
      }
    }
  }
}
