n = int(input()) x = list(map(int,input().split())) x.sort() mi = 10 ** 6 f = False for i in range(len(x) - 1): s = x[i + 1] - x[i] if mi > s and s > 0: f = True mi = s if n == 1 or f == False: print(0) else: print(mi)