// Arup Guha
// 6/8/2023
// Alternate Solution to Circle Lattice Points Problem

using namespace std;
#include <bits/stdc++.h>
typedef long long ll;

int main() {

    ll r;
    cin >> r;

    // These are my two pointers.
    ll low = 0, high = r;
    int res = 0;

    // We can sweep until these cross over. (No solutions for low==high.)
    while (low < high) {

        // Safe to increment low.
        if (low*low+high*high < r*r)
            low++;

        // Safe to decrement high.
        else if (low*low+high*high > r*r)
            high--;

        // A solution (so either 4 or 8 points!)
        else {
            if (low == 0) res += 4;
            else res += 8;
            low++;
            high--;
        }
    }

    // Ta da!
    cout << res << endl;
    return 0;
}
