using System; using System.Text; using System.Linq; using System.Collections; using System.Collections.Generic; using static System.Console; using static System.Math; namespace YukiCoder { public class Program { public static void Main(string[] args) { new Program().Solve(); } public void Solve() { int n = int.Parse(ReadLine()); int[] a = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray(); Array.Sort(a); bool isDuplicated = false; for (int i = 0; i < a.Length - 1; i++) { for (int j = i + 1; j < a.Length; j++) { if (a[i] == a[j]) isDuplicated = true; } } int min; if (isDuplicated) // same num { min = 0; } else { min = Abs(a[0] - a[1]); } WriteLine(min); WriteLine(Abs(a[0] - a[a.Length -1])); } } }