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