# -*- coding: utf-8 -*- N = int(input()) X = list(map(int, input().split())) X.sort() ans = 1000001 for i in range(N-1): a = X[i] b = X[i+1] dist = abs(a-b) if a!=b: ans = min(ans, dist) print(0) if ans == 1000001 else print(ans)