#!/bin/python3 import sys n = int(input().strip()) l = list(map(int, input().strip().split())) f = abs(l[0]-l[1]) l = sorted(l) for i in range(len(l)-1): if abs(l[i]-l[i+1]) < f: f = abs(l[i]-l[i+1]) print(f)