using System; using System.Collections.Generic; using System.IO; using System.Linq; class Solution { static void Main(String[] args) { int n = Convert.ToInt32(Console.ReadLine()); string[] a_temp = Console.ReadLine().Split(' '); int[] a = Array.ConvertAll(a_temp,Int32.Parse); // your code goes here //O(n) loop int value = Int32.MaxValue; Array.Sort(a); for(int i = 1; i < n; i++) { if(Math.Abs(a[i - 1] - a[i]) < value) value = Math.Abs(a[i - 1] - a[i]); } Console.WriteLine(value); } }