N = gets.to_i L = Math.sqrt(N).ceil ans = 0 0.upto(L) do |x| 0.upto(L) do |y| next if x ** 2 + y ** 2 != N ans += 1 end end puts ans