n = int(input()) l = [int(i) for i in input().split()] min = 10000000 for i in range(len(l)-1): for j in range(i+1,len(l)): if abs(l[i]-l[j]) < min and l[i] != l[j]: min = abs(l[i]-l[j]) print(min)