# No.135 とりあえず1次元の問題 import sys n = int(input()) x = [int(i) for i in input().split()] if x == [] or len(x) <= 1: print(0) minimum = sys.maxsize x.sort() for i in range(n - 1): if x[i] != x[i + 1]: minimum = min(minimum, abs(x[i] - x[i + 1])) print(minimum if minimum != sys.maxsize else 0)