N = int(input()) A = list(map(int, input().split())) print(min([A[i + 1] - A[i] for i in range(N - 1)]), A[-1] - A[0],sep='\n')