#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a = 4;
  cin >> n;
  a += 4 * int(sqrt(double(n))) - 4;
  if (int(sqrt(double(n))) != sqrt(double(n))) {
    if (n + int(sqrt(double(n))) >=
        (int(sqrt(double(n))) + 1) * (1 + int(sqrt(double(n))))) {
      a += 2;
    }
    a += 2;
  }
  cout << a;
  return 0;
}
