fn main() { let n: usize = input_a_value(); let mut a: Vec = input_line(); a.sort(); let max = (a[0] - a[n - 1]).abs(); let mut min = 2 * 100_000; for i in 1..n { min = std::cmp::min((a[i] - a[i - 1]).abs(), min); } println!("{}\n{}", min, max); } #[allow(unused)] fn input_a_value() -> T { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); s.trim().parse().ok().unwrap() } #[allow(unused)] fn input_line() -> Vec { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); s.trim() .split_whitespace() .map(|e| e.parse().ok().unwrap()) .collect() } #[allow(unused)] fn input_matrix_num(n_lines: usize) -> Vec> { (0..n_lines).map(|_| input_line()).collect() } #[allow(unused)] fn input_line_string() -> String { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); s.trim().to_string() } #[allow(unused)] fn input_line_vch() -> Vec { input_line_string().chars().collect() } #[allow(unused)] fn input_matrix_ch(n_lines: usize) -> Vec> { (0..n_lines).map(|_| input_line_vch()).collect() }