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()), i, minDiff = int.MaxValue, diff; string[] a_temp = Console.ReadLine().Split(' '); int[] a = Array.ConvertAll(a_temp,Int32.Parse); // your code goes here a = a.OrderBy(x => x).ToArray(); for(i = 0; i < n - 1; i++) { diff = Math.Abs(a[i] - a[i + 1]); minDiff = minDiff < diff ? minDiff : diff; } Console.WriteLine(minDiff); } }