#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000005, mod = 1e9 + 7;
int main() {
  int a, b, c, d, e, f, g, n, m, z, w;
  scanf("%d", &n);
  for (a = 1; a * a <= n; a++)
    ;
  a--;
  b = 4 * a;
  n -= a * a;
  if (n > a)
    b += 4;
  else if (n > 0)
    b += 2;
  printf("%d", b);
  return 0;
}
