#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  long long n, ans, a, b, c, d;
  cin >> n;
  a = ceil(sqrt(n));
  b = a;
  c = b - 1;
  d = b + 1;
  if (a * c >= n)
    ans = a + c;
  else if (a * b >= n)
    ans = a + b;
  else
    ans = a + d;
  cout << ans * 2;
  return 0;
}
