n = int(input()) seq = input().split() int_seq = [int(i) for i in seq] int_seq.sort() seq_set = set(int_seq) int_seq_set = list(seq_set) num = len(int_seq_set) minimum = int_seq_set[1] - int_seq_set[0] for i in range(num - 1): diff = int_seq_set[i+1] - int_seq_set[i] if diff < minimum: minimum = diff print(minimum)