N = int(raw_input()) X = map(int, raw_input().split()) X.sort() min = 1000001 for i in range(0, N-1): d = X[i+1]-X[i] if d < min: min = d if N == 1: min = 0 print min