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