N = int(input()) L = list(map(int,input().split())) L = list(set(L)) L = sorted(L) ans = float("inf") if len(L) == 1 : ans = 0 else : for i in range(len(L)-1) : calc = L[i+1]-L[i] ans = min(ans,calc) print(ans)