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