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: usize = itr.next().unwrap().parse().unwrap(); let mut a: Vec = (0..n) .map(|_| itr.next().unwrap().parse().unwrap()) .collect(); a.sort(); a.dedup(); if a.len() < 2 { println!("0"); return; } let mut ans = 1 << 30; for i in 0..a.len() - 1 { ans = std::cmp::min(ans, a[i + 1] - a[i]); } println!("{}", ans); }