class Problem0135: def solve(this): n = int(input()) x = sorted(list(map(int,input().split()))) res = [] for i in range(len(x) - 1): d = abs(x[i+1] - x[i]) if d != 0: res.append(d) print(min(res)) if __name__ == "__main__": problem = Problem0135() problem.solve()