use std::io; use std::io::prelude::*; fn gcd(a: i32, b: i32) -> i32 { if a < b { gcd(b, a) } else if b == 0 { a } else { gcd(b, a % b) } } fn run(args: &Vec) -> i32 { let l: i32 = args[0].parse().expect("number is expected"); let max_m = (l as f64).sqrt().floor() as i32; (2..(max_m + 1)).map(|m| { (1..m).filter(|n| { (m - n) % 2 == 1 && gcd(m, *n) == 1 && 8 * m * (m + n) <= l }).count() as i32 }).fold(0, |sum, i| sum + i) } fn main() { let stdin = io::stdin(); let args = stdin.lock().lines().map(|l| l.unwrap()).collect(); let r = run(&args); println!("{}", r); }