fn getline() -> String { let mut __ret = String::new(); std::io::stdin().read_line(&mut __ret).ok(); return __ret; } fn abs_diatance(distance: i32) -> i32 { let mut result = distance; if distance < 0 { result = distance * -1; } return result; } fn main() { let n: usize = getline().trim().parse().unwrap(); let line = getline(); let v: Vec<_> = line.trim().split(' ').collect(); let mut points: Vec = Vec::new(); for i in 0..n { let point: i32 = v[i].trim().parse().unwrap(); points.push(point); } points.sort(); let mut min_distance = 1000000; for i in 1..n-1 { if points[i+1] == points[i] { continue; } let mut distance = points[i+1] - points[i]; distance = abs_diatance(distance); if distance < min_distance { min_distance = distance; } } println!("{}", min_distance); }