input() dat = list(map(int, input().split())) dat.sort() ary =[] for i in range(len(dat)-1): ary += [dat[i+1] - dat[i]] print(min(ary))