use std::io; use std::collections::HashMap; fn solve() -> i64 { // input! { // x: i64, // } let x: i64 = input().parse().unwrap(); let mut cubes: HashMap> = HashMap::new(); for a in 0..=300i64 { 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; eprintln!("{:?} {:?}", abc, def); } } } } } eprintln!("{}", cubes.len()); 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()); }