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