#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 10;
int main() {
  ios_base ::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  int ans = INF;
  for (int i = 1; i <= n; ++i) {
    int a = i;
    int b = (n + a - 1) / a;
    ans = min(ans, 2 * a + 2 * b);
  }
  cout << ans << '\n';
  return 0;
}
