#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long b;
  long long ans = 0;
  long long n2 = ((n) * (n));
  long long i2;
  long long aux;
  long long top = n, topaux;
  for (long long i = 0; i <= n; i++) {
    i2 = ((i) * (i));
    long long j = n2 - i2;
    for (topaux = top; topaux >= 0; topaux--) {
      if (((topaux) * (topaux)) <= j) break;
    }
    aux = top - topaux;
    if (aux == b)
      ans++;
    else
      ans += aux;
    top = topaux;
  }
  if (n == 0)
    cout << "1";
  else
    cout << ans * 4 - 4;
  return 0;
}
