#include <bits/stdc++.h>
using namespace std;
const int INF = 2e9;
const int MX = 100005;
const int MOD = 1000000007;
const double PI = acos(-1.0);
int main() {
  std::ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  int sq = sqrt(n);
  int p = 4 * sq;
  n -= sq * sq;
  if (n > 0) {
    p += 2;
    n -= sq;
  }
  if (n > 0) p += 2;
  cout << p << "\n";
  return 0;
}
