#include <bits/stdc++.h>
using namespace std;
int const inf = 1000 * 1000 * 1000;
long long const inf64 = 1ll * inf * inf;
int main() {
  int n;
  cin >> n;
  int res = inf;
  for (int x = 1; x <= n; x++) {
    int y = (n + x - 1) / x;
    res = min(res, 2 * (x + y));
  }
  cout << res << "\n";
  return 0;
}
