#include <bits/stdc++.h>
using namespace std;
const int N = 21, INF = 1e9;
const double PI = 3.141592653589793238462643383279502884197, eps = 1e-6;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int x, ans = INF;
  cin >> x;
  for (int i = 1; i <= x; i++)
    ans = min(ans, i * 2 + (int)ceil(1.0 * x / i) * 2);
  cout << ans;
  return 0;
}
