input() x = sorted(list(set(map(int,raw_input().split())))) n = len(x)-1 print min(x[i+1]-x[i] for i in range(n)) if n else 0