inputer = int(input()) lister = input().split(" ") num_lister = [int(i) for i in list(lister)] num_lister.sort() min_d =num_lister[1]-num_lister[0] for inin in range(inputer): if inin > 1: if min_d > num_lister[inin]-num_lister[inin-1]: min_d=num_lister[inin]-num_lister[inin-1] print(min_d)