use std::collections::VecDeque; fn main() { let mut n = String::new(); std::io::stdin().read_line(&mut n).ok(); let n: usize = n.trim().parse().unwrap(); let mut cands = vec![false; n+1]; for i in 1.. { let val = i * (i+1) / 2; if val > n { break; } if val == n { println!("1"); return; } cands[n-val] = true; } for i in 1.. { let val = i * (i+1) / 2; if val > n { break; } if cands[val] { println!("2"); return; } } println!("3"); }