class Program { static void Main(string[] args) { string inputCount = Console.ReadLine()!; string[] inputNum = Console.ReadLine()!.Split(' '); List numList = new List(); int ans = 0; int count = 0; if (inputCount == "1") { Console.WriteLine(0); return; } for (int i = 0; i < inputNum.Length; i++) { numList.Add(int.Parse(inputNum[i])); } numList.Sort(); for (int i = 1; i < numList.Count; i++) { int firstPoint = numList[i - 1]; int secondPoint = numList[i]; if (secondPoint - firstPoint != 0) { if (count == 0) { ans = secondPoint - firstPoint; count++; } else if (ans > secondPoint - firstPoint && count == 1) { ans = secondPoint - firstPoint; } } } if (ans <= -1) { ans *= -1; } Console.WriteLine(ans); } }