#!/bin/python3 import sys n = int(input().strip()) a = sorted(list(map(int, input().strip().split(' ')))) print(min(y-x for x,y in zip(a,a[1:])))