import math n = int(input()) l = list(map(int, input().split())) min = 0 if n <= 1 or len(set(l)) == 0: print('0') else: for i in range(n): for j in range(n): if not l[i] == l[j]: if min == 0 or abs(l[i] - l[j]) < min: min = abs(l[i] - l[j]) print(min)