n = gets.to_i
n2 = n * n
ans = 0
(1...n).each do |x|
  y = Math.sqrt(n2 - x * x)
  if y == y.to_i
    ans += 1
  end
end
puts ans