#!/bin/python3 import sys import itertools n = int(input().strip()) a = list(map(int, input().strip().split(' '))) a.sort() # your code goes here tuples = [] first = 0 second = 1 for element in range (0, len(a)-1): tup = (a[first], a[second]) tuples.append(tup) first += 1 second +=1 differences = [] for t in tuples: difference = t[1] - t[0] differences.append(difference) print(min(differences))