#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long ans = 0;
  if (n == 0) {
    puts("1");
    return 0;
  }
  for (long long x = 0, y = n; x < n; x++) {
    while ((long long)x * x + (long long)y * y > (long long)n * n) y--;
    long long t = y;
    while (y > 0) {
      if ((long long)(x + 1) * (x + 1) + (long long)y * y > (long long)n * n ||
          (long long)x * x + (long long)(y + 1) * (y + 1) > (long long)n * n) {
        ans++;
      } else
        break;
      y--;
    }
    y = t;
  }
  cout << ans * 4 << endl;
  return 0;
}
