n = int(input()) l = list(map(int, input().split())) l.sort() min = 10000000 for i in range(n-1): if min > l[i+1]-l[i]: if l[i+1]-l[i]!=0: min=l[i+1]-l[i] if min == 10000000: min = 0 print(min)