#!/bin/python import sys n = int(raw_input().strip()) a = map(int, raw_input().strip().split(' ')) # your code goes here a, size = sorted(a), len(a) res = [a[i + 1] - a[i] for i in range(size) if i+1 < size] print min(res)