#include <bits/stdc++.h>
using namespace std;
const int INF = INT_MAX;
const long long INFL = LLONG_MAX;
const int output_precision = 15;
const bool debug = true;
stringstream ss;
long long N;
set<pair<long long, long long> > found;
int main() {
  ios_base::sync_with_stdio(0);
  cout.precision(output_precision);
  cout << fixed;
  ss.precision(output_precision);
  ss << fixed;
  cin >> N;
  if (N == 0) {
    cout << 1 << '\n';
    return 0;
  }
  if (N <= 2) {
    cout << N * 4 << '\n';
    return 0;
  }
  long long N2 = N * N;
  long long ans = 0;
  long long x = 1;
  long long y = sqrt(N * N - x * x);
  while (x < N) {
    if ((x + 1) * (x + 1) + y * y > N2 || (y + 1) * (y + 1) + x * x > N2) ans++;
    if ((x + 1) * (x + 1) + y * y <= N2)
      x++;
    else
      y--;
  }
  ans++;
  ans *= 4;
  cout << ans << '\n';
}
