# -*- coding: utf-8 -*- N = input() inp = map(int, raw_input().split()) inp.sort() minn = float("inf") flag = 0 for i in range(0, N-1): tmp = inp[i+1] - inp[i] if tmp != 0 and tmp < minn: minn = tmp flag = 1 if flag: print minn else: print 0