n = int(raw_input()) l = map(int, raw_input().split()) l.sort() if len(l) == 1: print 0 else: mn = 10**7 for i in range(n-1): d = l[i+1] - l[i] if d > 0: mn = min(mn,d) print mn