#include <bits/stdc++.h>
using namespace std;
const int N = int(3e5), mod = int(1e9) + 7;
int n;
int main() {
  cin >> n;
  int ans = 2 * n + 2;
  for (int i = 1; i <= n; i++) {
    int k = (n + i - 1) / i;
    ans = min(ans, 2 * k + 2 * i);
  }
  cout << ans;
  return 0;
}
