#!/bin/python3 import sys n = int(input().strip()) a = list(map(int, input().strip().split(' '))) # your code goes here a.sort() b = [abs(i-j) for i,j in zip(a[1:], a[:-1])] print(min(b))