# -*- coding:utf-8 -*- from itertools import combinations calc_distance = lambda xs: abs(xs[0] - xs[1]) if __name__ == '__main__': n = int(input()) xn = set(map(int, input().split())) if len(xn) < 0: print(0) else: print(min(map(calc_distance, combinations(xn, 2))))