#!/bin/python

import sys


n = int(raw_input().strip())
a = list(map(int, raw_input().strip().split(' ')))
a.sort()
def mod(x):
    if x>0:
        return x
    return -x
l=[]
for i in range(1,n):
    l+=[mod(a[i]-a[i-1])]
print min(l)
    # your code goes here