#include <bits/stdc++.h>
using namespace std;
int Y[40000005];
int SQRT(long long cur) { return sqrt(cur); }
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long n, ans = 0;
  cin >> n;
  for (long long i = 1; i < n; i++) ans++, Y[i] = SQRT(n * n - i * i);
  for (long long i = 1; i < n; i++)
    if (Y[SQRT(n * n - i * i)] != i) ans++;
  ans <<= 2;
  ans += (n ? 4 : 1);
  cout << ans << "\n";
  return 0;
}
