import sys N = int(input()) x = list(map(int, input().split())) x = list(set(x)) x = sorted(x) mini = 10**6 if len(x) == 0: print('0') sys.exit(0) for i in range(1, len(x)): a = x[i]-x[i-1] if a < mini: mini = a print(mini)