N = int(input()) X = list(map(int,input().split(" "))) a = list(set(sorted([abs(X[i] - X[i + 1]) for i in range(N) if i + 1 < N]))) if 0 in a: a.remove(0) if a == []: print(0) else: print(min(a)) else: print(min(a))