#include <bits/stdc++.h>
using namespace std;
vector<int> vec[1001];
vector<bool> vis;
int main() {
  int tc, cse = 0;
  {
    int n;
    cin >> n;
    int sqt = sqrt(n);
    int total = sqt * 4;
    int rem = n - (sqt * sqt);
    int rem1 = rem / sqt;
    if (rem % sqt) rem1++;
    total += rem1 * 2;
    cout << total << endl;
  }
}
