#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-8;
int main() {
  int n;
  cin >> n;
  int rt = int(sqrt(n) + EPS);
  rt += rt + (rt * rt != n) + (rt * (rt + 1) < n);
  cout << rt + rt;
  return 0;
}
