n = int(input()) x = list(map(int, input().split())) x.sort() dis = [] d = 0 for i in range(1,n): d = x[i] - x[i-1] if d != 0: dis.append(d) print(min(dis))