using System; namespace yukicoder { class Program { static void Main(string[] args) { int a = int.Parse(Console.ReadLine()); string[] s = Console.ReadLine().Split(' '); int[] b = new int[a]; int min = 0; int max=0; int ans = 0; for(int x = 0; x < a; x++) { b[x] = int.Parse(s[x]); if (b[x] == 0) { continue; } for (int y = 1; y < a; y++) { b[y] = int.Parse(s[y]); if (b[x] > b[y]) { max = b[x]; min = b[y]; } else { max = b[y]; min = b[x]; } if ( min != 0 && max != 0) { if (max == min) { if (ans==0||ans > min) ans = min; } else { int c = max - min; if (ans == 0) { ans = c; } if (ans > c) { ans = c; } } } } } Console.WriteLine(ans); } } }