use std::io::*; use std::str::FromStr; use std::cmp; #[allow(dead_code)] fn get_line() -> String { let stdin = stdin(); let mut line = String::new(); stdin.lock().read_line(&mut line).expect("io error."); line.trim().to_string() } #[allow(dead_code)] fn get_word() -> T { (&get_line()).parse().ok().expect("parse error.") } #[allow(dead_code)] fn get_vec() -> Vec { (&get_line()).split(' ').map(|x| x.parse().ok().expect("parse error.")).collect() } fn main() { let _ = get_word::(); let mut x = get_vec::(); x.sort(); x.dedup(); let n = x.len(); let mut ans: i64 = 10i64.pow(10); if n == 1 {ans = 0}; for i in 0..n-1 { ans = cmp::min(ans, x[i + 1] - x[i]); } println!("{}", ans); }