#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int a, b, ans, c = 0, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r,
                           s, t, u, v, w;
  cin >> n;
  for (i = 0; i * i <= n; i++) {
  }
  i--;
  a = i;
  b = (n - i * i) / i + i;
  if ((n - i * i) % i == 0) {
    c = 0;
  } else {
    c = 2;
  }
  cout << 2 * a + 2 * b + c << endl;
}
