#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  float square = sqrt(n);
  float csquare = ceil(square);
  if ((csquare == square) || (csquare - square <= 0.5)) {
    cout << 4 * csquare;
  } else if (csquare - square > 0.5) {
    cout << 2 * (csquare + (csquare - 1));
  }
  return 0;
}
