n=int(input()) s=sorted(list(set(map(int,input().split())))) m=[] for i in range(n-1): m+=[s[i+1]-s[i]] print(min(m))