def main(): N = int(input()) X = tuple(map(int, input().split())) x = sorted(X) l = [0] * (N - 1) for i in range(N - 1): l[i] = x[i+1] - x[i] print(min(l)) main()