use std::cmp::max; use std::io::*; fn main() { let mut s: String = String::new(); std::io::stdin().read_to_string(&mut s).ok(); let mut itr = s.trim().split_whitespace(); let n: u64 = itr.next().unwrap().parse().unwrap(); let m = n * (n + 1) / 2; let mut ans = 0; let mut i = 1; while i * i <= m { if m % i == 0 { if i <= n { ans = max(ans, i); } if m / i <= n { ans = max(ans, m / i) } } i += 1; } println!("{}", ans); }