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