#include <bits/stdc++.h>
int main() {
  int n, x;
  double y;
  scanf("%d", &n);
  x = sqrt(n);
  y = sqrt(n);
  if (x == y) {
    x = x - 1;
  }
  if (n <= (x * (x + 1))) {
    x = 4 * x + 2;
  } else {
    x = x + 1;
    x = 4 * x;
  }
  printf("%d\n", x);
}
