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