input() s=list(map(int,input().split())) m=set([abs(x-y) for x in s for y in s]) m.remove(0) print(min(m))