def gcd(a, b) while true do r = a % b if r == 0 return b end a = b b = r end end l = gets.to_i m = 2 count = 0 while true do n = 1 limc = 0 while n < m do a = m * m - n * n b = 2 * m * n c = m * m + n * n if (a + b + c) * 4 > l n += 1 limc += 1 next end if gcd(a, b) != 1 n += 1 next end count += 1 n += 1 end if m - 1 == limc break end m += 1 end puts count