#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int res = 2 * n + 2;
  for (int i = 1; i <= n; i++) {
    int tmp = 2 * i + ((n - 1) / i + 1) * 2;
    res = min(res, tmp);
  }
  cout << res << endl;
  return 0;
}
