# coding=UTF-8 # import statistics n = int(input()) l = list(map(int, input().split())) s_l = set(l) num_list = list(s_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)) print(mile_list[-1])