fn main() { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); let n: u64 = s.trim().parse().unwrap(); let a = (1..n).fold(0, |c, x| { let y = n * n - x * x; c + (y == ((y as f64).sqrt().round() as u64).pow(2)) as u64 }); println!("{a}") }