N = int(input()) l = list(set(list(map(int, input().split())))) l.sort() x = [] #print(l) if len(l)==1: x = 0 else: for i in range(1,len(l)): x.append(l[i] - l[i-1]) x = min(x) print(x)