n = int(input()) x = sorted(list(set([int(i) for i in input().split()]))) min = 0 for i in range(len(x) - 1): d = x[i + 1] - x[i] if min == 0 or d < min: min = d print(min)