using System;
using System.Collections;
using System.Collections.Generic;
public class Program {
    public static void Main() {
        string line;
        while ((line = System.Console.ReadLine ()) != null) { // 注意 while 处理多个 case
            int r2 = int.Parse(line);
            int r = (int)Math.Sqrt(r2);
            int x = 0;
            int y = r;
            int count = 0;
            while(x <= r && y >= 0){
                int d2 = x * x + y * y;
                if(d2 == r2){
                    if((x == 0 && y == r) || (x == r && y == 0)) 
                        count += 2;
                    else 
                        count += 4;
                    x++;
                }
                else if(d2 < r2) 
                    x++;
                else 
                    y--;
            }
            Console.WriteLine(count);
        }
    }
}

沿着圆右上部分的曲线走,从12点钟开始走向3点方向,遇到优雅的点则判断是否是12点钟或3点钟,是则count+2,不是则count+4;