# coding=UTF-8 # import statistics n = int(input()) l = list(map(int, input().split())) s_l = set(l) num_l = list(s_l) num_list = sorted(num_l) pointA = list(num_list[:len(s_l)]) pointB = list(num_list[1:]) mile_list = list() for i, j in zip(pointA, pointB): mile_list.append(abs(i-j)) ans_list = sorted(mile_list, reverse=False) if len(ans_list) == 0: print(0) else: print(ans_list[0])