#include <bits/stdc++.h>
using namespace std;
const int N = 1234567;
const int mod = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, val, flag = 0;
  cin >> n;
  long long ans = 1e18;
  for (int i = 1; i <= n; i++) {
    int val = (n / i) + (n % i > 0);
    ans = min(ans, 1ll * 2 * (i + val));
  }
  cout << ans << endl;
  return 0;
}
