#include <bits/stdc++.h>
using namespace std;
const int M = 1e5 + 10;
int main() {
  int n;
  cin >> n;
  int sq = sqrt(n);
  if (sq * sq < n) sq++;
  cout << 2 * (sq + (n % sq == 0 ? (n / sq) : ((n / sq) + 1))) << endl;
  return 0;
}
