input()
X=sorted(set(map(int,input().split())))
O=X[-1]
for i in range(len(X)-1):
 D=X[i+1]-X[i]
 if O>D:O=D
print(O)