using System; using System.Collections.Generic; using System.Linq; class Magatro { static void Main() { int N = int.Parse(Console.ReadLine()); bool[] point = new bool[1000001]; string[] s = Console.ReadLine().Split(' '); for(int i = 0; i < N; i++) { point[int.Parse(s[i])] = true; } int min = int.MaxValue; bool a=false; int sta = 0; bool k = false; for(int i = 0; i <= 1000000; i++) { if (!k) { if (point[i]) { sta = i; k = true; } } else { if (point[i]) { min = Math.Min(min, i - sta); a = true; sta = i; } } } if (a) { Console.WriteLine(min); } else { Console.WriteLine(0); } } }