#include <bits/stdc++.h>
int main() {
  long a, b, c, i, min;
  scanf("%ld", &a);
  min = a;
  for (i = 1; i <= sqrt(a); i++) {
    if ((a % i) == 0) {
      b = a / i;
      c = i + b - 2;
      printf("%ld,%ld,%ld\n", i, b, c);
      if (min > c) {
        min = c;
      }
    }
  }
  printf("%ld\n", min);
  return 0;
}
