N = int(input()) l = list(map(int, input().split())) l.sort() ans = 1000000000000000000 for i in range(N - 1): if l[i + 1] - l[i] != 0: if ans >= l[i +1] -l[i]: ans = l[i + 1] - l[i] print(ans)