n = int(input()) x = list(map(int,input().split())) dif = [] x.sort() for i in range(n-1): dif.append(x[i+1] - x[i]) dif.sort() if dif[0] == 0 and dif[-1] == 0: ans = 0 else: for i in dif: if i != 0: ans = i break print(ans)