#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  int root;
  root = sqrt(n);
  int mul = root * root;
  if (mul == n)
    printf("%d", 4 * root);
  else if ((mul + root) >= n) {
    printf("%d", 4 * root + 2);
  } else {
    printf("%d", 4 * (root + 1));
  }
  return 0;
}
