n=input() x=sorted(list(set(map(int,raw_input().split())))) if len(x)==1: print 0 exit() y=[] for i in range(len(x)-1): y+=[x[i+1]-x[i]] print min(y)