#include <bits/stdc++.h>
const int MAXN = 1000000;
int main() {
  int n;
  scanf("%d", &n);
  int sqn = (int)sqrt(n);
  int rem = n - sqn * sqn;
  int adt = 0;
  if (rem == 0)
    ;
  else if (rem <= sqn)
    adt = 2;
  else
    adt = 4;
  printf("%d\n", 4 * sqn + adt);
  return 0;
}
