N = input() A = map(int, raw_input().split()) A.sort() ans = 1 << 50 for i in range(1, len(A)): if (A[i] == A[i - 1]): continue ans = min(ans, abs(A[i] - A[i - 1])) print ans