N = input() X = sorted(map(int, raw_input().split())) print min(X[i]-X[i+1] for i in xrange(N-1)) if len(X)>1 else 0