fn main() { let stdin = std::io::read_to_string(std::io::stdin()).unwrap(); let mut stdin = stdin.split_ascii_whitespace(); let n: usize = stdin.next().unwrap().parse().unwrap(); let a: Vec = (0..n) .map(|_| stdin.next().unwrap().parse().unwrap()) .collect(); println!("{}", output(solve(a))); } fn solve(a: Vec) -> (i32, i32) { ( a.windows(2).map(|a| a[1] - a[0]).min().unwrap(), a.last().unwrap() - a.first().unwrap(), ) } fn output(ans: (i32, i32)) -> String { ans.0.to_string() + "\n" + &ans.1.to_string() }