#coding: utf-8 ##yuki_135 import sys x=int(raw_input()) s=[] s=map(int,raw_input().split()) s.sort() dif=10**6+1 for i in xrange(1,len(s)): if s[-1]==0: print 0 sys.exit() if s[i]==s[i-1]: continue d=s[i]-s[i-1] dif=min(d,dif) print dif