from math import sqrt, floor def main(): N = int(input()) patterns = 0 half = N ** 2 // 2 if N % 2 == 0: if floor(sqrt(half)) ** 2 == half: patterns += 1 print(floor(sqrt(half))) for x in range(1, floor(sqrt(half)) + 1): y_square = N ** 2 - x ** 2 if floor(sqrt(y_square)) ** 2 == y_square: patterns += 2 print(patterns) if __name__ == "__main__": main()