// Thomas Meeks
// 6/6/2023
// Problem:
// Given the radius of a circle r, r is an integer (1 <= r <= 1000)
// Circles center is at (0,0)
// Determine the number of points that are at integer cordinates and are located
// on the perimeter of the polygon

// Solution:
// points that lie on the circle's perimeter will have follow the formula
// sqrt(x^2+ y^2) = r, because of distance formula
// To avoid floatingpoint calculations which can be both slow and inprecises
// we square both sides, x^2+y^2 = r^2,

// now if we construct a bounding box where x and y are between
//-rad and rad then we will only need to try points in this bounding box
// since no point on the circle can possible have a x or y value greater then r,
// now if we loop through all values of x and y with a double for-loop
//  we can count all the values of x,y where this equation is true.

// This solution is quite slow (n^2 time complexity)
// A linear solution exists that still avoids floatingpoint operations.
#include <iostream>
using namespace std;
int main() {
  int rad;
  cin >> rad; // take in radius
  int radsquared =
      rad * rad; // radius squared, do the multiplication once at the beggining.
  int count = 0;
  // need to start x and y at the negative radius (not 0)
  // make sure x,y <= rad (not <) since at the cardinal points x,y = rad
  for (int x = -rad; x <= rad; x++) {
    for (int y = -rad; y <= rad; y++) {
      // checking if x^2 + y^2 == r^2
      if (x * x + y * y == radsquared)
        count++;
    }
  }

  // output the answer!
  cout << count;
}