use std::io; use std::collections::HashMap; fn solve() -> u32 { // input! { // x: i64, // } let x: u32 = input().parse().unwrap(); let mut cubes: HashMap> = HashMap::new(); for a in 0..=300u32 { for b in a..=300 { for c in b..=300 { let abc = (a, b, c); let y = a.pow(3) + b.pow(3) + c.pow(3); if let Some(v) = cubes.get(&y) { let mut u = v.clone(); u.push(abc); cubes.insert(y, u); }else { cubes.insert(y, vec![abc]); } } } } let mut ans = 0; for (&y, def_vec) in cubes.iter() { if let Some(v) = cubes.get(&(x - y)) { for &abc in v { for def in def_vec { if abc.2 <= def.0 { ans += 1; } } } } } return ans; } fn input() -> String { let mut buffer = String::new(); io::stdin().read_line(&mut buffer).unwrap(); return buffer.trim().to_string(); } fn main() { println!("{}", solve()); }