n=int(input()) a= sorted(map(int,input().split())) b=float("inf") for i in range(n-1): b=min(a[i+1]-a[i],b) print(b)