n = int(input()) x = sorted(map(int, input().split())) l = [x[i+1] - x[i] for i in range(n-1)] print([min(l), 0][l == []])