#!/bin/python3 import collections import math import sys n = int(input().strip()) a = list(map(int, input().strip().split(' '))) # your code goes here a.sort() i = 0 minDif = float("inf") while i < n - 1: if abs(a[i] - a[i+1]) < minDif: minDif = abs(a[i] - a[i+1]) i += 1 print(minDif)