#include <bits/stdc++.h>
using namespace std;
const int maxn = 4e7;
bool vis[maxn + 10];
int main() {
  int r;
  cin >> r;
  if (r == 0) {
    cout << 1 << endl;
    return 0;
  }
  long long num = r;
  long long tp = 1LL * r * r;
  for (int i = 0; i < r; ++i) {
    long long tp1 = tp - 1LL * i * i;
    vis[int(sqrt(tp1))] = true;
  }
  for (int i = 1; i <= r; ++i)
    if (!vis[i]) num++;
  cout << num * 4 << endl;
  return 0;
}
