#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  int sq = sqrt(n);
  if (sq * sq == n)
    cout << 2 * (sq + sq) << '\n';
  else if (sq * sq + sq < n)
    cout << 2 * (sq + 1 + sq + 1) << '\n';
  else
    cout << 2 * (sq + sq + 1) << '\n';
  return 0;
}
