map(int, input().split()) a=sorted(map(int, input().split())) print(min((w-q for q,w in zip(a,a[1:]) if q!=w), default=0))