#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int k1 = sqrt(n);
  int k2 = k1 * k1;
  int l1 = ceil(1.00 * (n - k2) / k1);
  int perimetro;
  perimetro = 4 * k1 + 2 * (l1);
  cout << perimetro;
  return 0;
}
