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